-
Notifications
You must be signed in to change notification settings - Fork 7
added VersionSubscriber with creation of versions #97
Conversation
@@ -14,7 +14,8 @@ | |||
"jackalope/jackalope-doctrine-dbal": "~1.2.3", | |||
"phpunit/phpunit": "^4.5", | |||
"monolog/monolog": "^1.1", | |||
"phpbench/phpbench": "0.10.*" | |||
"phpbench/phpbench": "0.10.*", | |||
"symfony/phpunit-bridge": "~2.7" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wachterjohannes What version should this dependency be set to now? I need it because of the ClockMock
class.
Tests are failing because I had to reintroduce the phpunit-bridge from Symfony for the |
Nevermind, fixed it 🙈 Had just to use the correct slugifier class. However, I am still in favour of not using the Symfony CMF slugifier at all, since it doesn't add any value. If we would just use the |
@@ -137,6 +139,17 @@ public function removeDraft($document, $locale) | |||
/** | |||
* {@inheritdoc} | |||
*/ | |||
public function restore($document, $locale, $version, array $options = []) | |||
{ | |||
$options = $this->getOptionsResolver(Events::FIND)->resolve($options); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Events::RESTORE
'locale' => $versionInformation['locale'], | ||
'version' => $version->getName(), | ||
'author' => $versionInformation['author'], | ||
'authored' => date('c', time()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use only date('c')
$contentPropertyPrefix = $this->propertyEncoder->localizedContentName('', $event->getLocale()); | ||
$systemPropertyPrefix = $this->propertyEncoder->localizedSystemName('', $event->getLocale()); | ||
|
||
$node = $event->getNode(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add comment
$version = $this->versionManager->getVersionHistory($node->getPath())->getVersion($event->getVersion()); | ||
$frozenNode = $version->getFrozenNode(); | ||
|
||
foreach ($frozenNode->getPropertiesValues() as $name => $value) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add comment
created and changed date is missing in the live session |
This PR adds a new subscriber, which creates a new version everytime a document is published. In addition to that it keeps documents checked out if necessary.