diff --git a/lib/Alchemy/Phrasea/Border/Manager.php b/lib/Alchemy/Phrasea/Border/Manager.php index 55c28d9cbf..d017d206e6 100644 --- a/lib/Alchemy/Phrasea/Border/Manager.php +++ b/lib/Alchemy/Phrasea/Border/Manager.php @@ -15,7 +15,7 @@ use Alchemy\Phrasea\Application; use Alchemy\Phrasea\Border\Checker\CheckerInterface; use Alchemy\Phrasea\Border\Attribute\AttributeInterface; use Alchemy\Phrasea\Core\Event\Record\RecordEvents; -use Alchemy\Phrasea\Core\Event\Record\SubdefinitionBuildEvent; +use Alchemy\Phrasea\Core\Event\Record\SubdefinitionCreateEvent; use Alchemy\Phrasea\Exception\RuntimeException; use Alchemy\Phrasea\Metadata\Tag\TfArchivedate; use Alchemy\Phrasea\Metadata\Tag\TfQuarantine; @@ -335,7 +335,7 @@ class Manager $this->app['phraseanet.metadata-setter']->replaceMetadata($newMetadata, $element); if(!$nosubdef) { - $this->app['dispatcher']->dispatch(RecordEvents::SUBDEFINITION_BUILD, new SubdefinitionBuildEvent($element, true)); + $this->app['dispatcher']->dispatch(RecordEvents::SUBDEFINITION_CREATE, new SubdefinitionCreateEvent($element, true)); } return $element; diff --git a/lib/Alchemy/Phrasea/Controller/Prod/StoryController.php b/lib/Alchemy/Phrasea/Controller/Prod/StoryController.php index 19acc22a27..a90f0a0ed1 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/StoryController.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/StoryController.php @@ -15,7 +15,7 @@ use Alchemy\Phrasea\Controller\Controller; use Alchemy\Phrasea\Controller\RecordsRequest; use Alchemy\Phrasea\Controller\Exception as ControllerException; use Alchemy\Phrasea\Core\Event\Record\RecordEvents; -use Alchemy\Phrasea\Core\Event\Record\SubdefinitionBuildEvent; +use Alchemy\Phrasea\Core\Event\Record\SubdefinitionCreateEvent; use Alchemy\Phrasea\Core\Event\RecordEdit; use Alchemy\Phrasea\Core\PhraseaEvents; use Alchemy\Phrasea\Model\Entities\StoryWZ; @@ -72,7 +72,7 @@ class StoryController extends Controller $recordAdapter = $story->set_metadatas($metadatas); // tell phraseanet to rebuild subdef - $this->dispatch(RecordEvents::SUBDEFINITION_BUILD, new SubdefinitionBuildEvent($recordAdapter)); + $this->dispatch(RecordEvents::SUBDEFINITION_CREATE, new SubdefinitionCreateEvent($recordAdapter)); $storyWZ = new StoryWZ(); $storyWZ->setUser($this->getAuthenticatedUser()); diff --git a/lib/Alchemy/Phrasea/Controller/Prod/ToolsController.php b/lib/Alchemy/Phrasea/Controller/Prod/ToolsController.php index 2318cf0638..65f72a8a36 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/ToolsController.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/ToolsController.php @@ -16,7 +16,7 @@ use Alchemy\Phrasea\Application\Helper\SubDefinitionSubstituerAware; use Alchemy\Phrasea\Controller\Controller; use Alchemy\Phrasea\Controller\RecordsRequest; use Alchemy\Phrasea\Core\Event\Record\RecordEvents; -use Alchemy\Phrasea\Core\Event\Record\SubdefinitionBuildEvent; +use Alchemy\Phrasea\Core\Event\Record\SubdefinitionCreateEvent; use Alchemy\Phrasea\Exception\RuntimeException; use Alchemy\Phrasea\Metadata\PhraseanetMetadataReader; use Alchemy\Phrasea\Metadata\PhraseanetMetadataSetter; @@ -157,7 +157,7 @@ class ToolsController extends Controller } if (!$substituted || $force) { - $this->dispatch(RecordEvents::SUBDEFINITION_BUILD, new SubdefinitionBuildEvent($record)); + $this->dispatch(RecordEvents::SUBDEFINITION_CREATE, new SubdefinitionCreateEvent($record)); } } diff --git a/lib/Alchemy/Phrasea/Core/Event/Record/RecordEvents.php b/lib/Alchemy/Phrasea/Core/Event/Record/RecordEvents.php index ac725833ac..e68f4afa84 100644 --- a/lib/Alchemy/Phrasea/Core/Event/Record/RecordEvents.php +++ b/lib/Alchemy/Phrasea/Core/Event/Record/RecordEvents.php @@ -29,7 +29,7 @@ final class RecordEvents const SUB_DEFINITIONS_CREATED = 'record.sub_definitions_created'; const SUB_DEFINITION_CREATION_FAILED = 'record.sub_definition_creation_failed'; - const SUBDEFINITION_BUILD = 'record.subdefinition_build'; + const SUBDEFINITION_CREATE = 'record.subdefinition_create'; const MEDIA_SUBSTITUTED = 'record.media_substituted'; diff --git a/lib/Alchemy/Phrasea/Core/Event/Record/SubdefinitionBuildEvent.php b/lib/Alchemy/Phrasea/Core/Event/Record/SubdefinitionCreateEvent.php similarity index 92% rename from lib/Alchemy/Phrasea/Core/Event/Record/SubdefinitionBuildEvent.php rename to lib/Alchemy/Phrasea/Core/Event/Record/SubdefinitionCreateEvent.php index 701e3a2028..cbb36f4184 100644 --- a/lib/Alchemy/Phrasea/Core/Event/Record/SubdefinitionBuildEvent.php +++ b/lib/Alchemy/Phrasea/Core/Event/Record/SubdefinitionCreateEvent.php @@ -13,7 +13,7 @@ namespace Alchemy\Phrasea\Core\Event\Record; use Alchemy\Phrasea\Model\RecordInterface; -class SubdefinitionBuildEvent extends RecordEvent +class SubdefinitionCreateEvent extends RecordEvent { private $isNewRecord; diff --git a/lib/Alchemy/Phrasea/Core/Event/Subscriber/RecordEditSubscriber.php b/lib/Alchemy/Phrasea/Core/Event/Subscriber/RecordEditSubscriber.php index e58e77cdf7..6c971002e5 100644 --- a/lib/Alchemy/Phrasea/Core/Event/Subscriber/RecordEditSubscriber.php +++ b/lib/Alchemy/Phrasea/Core/Event/Subscriber/RecordEditSubscriber.php @@ -13,7 +13,7 @@ namespace Alchemy\Phrasea\Core\Event\Subscriber; use Alchemy\Phrasea\Core\Event\Record\CollectionChangedEvent; use Alchemy\Phrasea\Core\Event\Record\RecordEvent; use Alchemy\Phrasea\Core\Event\Record\RecordEvents; -use Alchemy\Phrasea\Core\Event\Record\SubdefinitionBuildEvent; +use Alchemy\Phrasea\Core\Event\Record\SubdefinitionCreateEvent; use Alchemy\Phrasea\Core\Event\RecordEdit; use Alchemy\Phrasea\Core\PhraseaEvents; use Alchemy\Phrasea\Metadata\Tag\TfEditdate; @@ -27,11 +27,11 @@ class RecordEditSubscriber implements EventSubscriberInterface public static function getSubscribedEvents() { return array( - PhraseaEvents::RECORD_EDIT => 'onEdit', - PhraseaEvents::RECORD_UPLOAD => 'onEdit', - RecordEvents::ROTATE => 'onRecordChange', - RecordEvents::COLLECTION_CHANGED => 'onCollectionChanged', - RecordEvents::SUBDEFINITION_BUILD => 'onBuildSubdefs', + PhraseaEvents::RECORD_EDIT => 'onEdit', + PhraseaEvents::RECORD_UPLOAD => 'onEdit', + RecordEvents::ROTATE => 'onRecordChange', + RecordEvents::COLLECTION_CHANGED => 'onCollectionChanged', + RecordEvents::SUBDEFINITION_CREATE => 'onSubdefinitionCreate', ); } @@ -51,7 +51,7 @@ class RecordEditSubscriber implements EventSubscriberInterface $recordAdapter->clearStampCache(); } - public function onBuildSubdefs(SubdefinitionBuildEvent $event) + public function onSubdefinitionCreate(SubdefinitionCreateEvent $event) { $recordAdapter = $this->convertToRecordAdapter($event->getRecord()); $recordAdapter->rebuild_subdefs(); diff --git a/lib/Alchemy/Phrasea/Media/SubdefSubstituer.php b/lib/Alchemy/Phrasea/Media/SubdefSubstituer.php index 1d096cf785..8f7aa61e90 100644 --- a/lib/Alchemy/Phrasea/Media/SubdefSubstituer.php +++ b/lib/Alchemy/Phrasea/Media/SubdefSubstituer.php @@ -13,7 +13,7 @@ namespace Alchemy\Phrasea\Media; use Alchemy\Phrasea\Application; use Alchemy\Phrasea\Core\Event\Record\MediaSubstitutedEvent; use Alchemy\Phrasea\Core\Event\Record\RecordEvents; -use Alchemy\Phrasea\Core\Event\Record\SubdefinitionBuildEvent; +use Alchemy\Phrasea\Core\Event\Record\SubdefinitionCreateEvent; use Alchemy\Phrasea\Filesystem\FilesystemService; use MediaAlchemyst\Alchemyst; use MediaAlchemyst\Exception\ExceptionInterface as MediaAlchemystException; @@ -80,7 +80,7 @@ class SubdefSubstituer $record->write_metas(); if ($shouldSubdefsBeRebuilt) { - $this->dispatcher->dispatch(RecordEvents::SUBDEFINITION_BUILD, new SubdefinitionBuildEvent($record)); + $this->dispatcher->dispatch(RecordEvents::SUBDEFINITION_CREATE, new SubdefinitionCreateEvent($record)); } $this->dispatcher->dispatch(RecordEvents::MEDIA_SUBSTITUTED, new MediaSubstitutedEvent($record)); diff --git a/lib/Alchemy/Phrasea/TaskManager/Job/ArchiveJob.php b/lib/Alchemy/Phrasea/TaskManager/Job/ArchiveJob.php index db1f6b083a..de418a4e71 100644 --- a/lib/Alchemy/Phrasea/TaskManager/Job/ArchiveJob.php +++ b/lib/Alchemy/Phrasea/TaskManager/Job/ArchiveJob.php @@ -13,7 +13,7 @@ namespace Alchemy\Phrasea\TaskManager\Job; use Alchemy\Phrasea\Application; use Alchemy\Phrasea\Core\Event\Record\RecordEvents; -use Alchemy\Phrasea\Core\Event\Record\SubdefinitionBuildEvent; +use Alchemy\Phrasea\Core\Event\Record\SubdefinitionCreateEvent; use Alchemy\Phrasea\Exception\RuntimeException; use Alchemy\Phrasea\Border\File; use Alchemy\Phrasea\Border\Manager as borderManager; @@ -1035,7 +1035,7 @@ class ArchiveJob extends AbstractJob $story->setStatus(\databox_status::operation_or($stat0, $stat1)); - $app['dispatcher']->dispatch(RecordEvents::SUBDEFINITION_BUILD, new SubdefinitionBuildEvent($story)); + $app['dispatcher']->dispatch(RecordEvents::SUBDEFINITION_CREATE, new SubdefinitionCreateEvent($story)); unset($media); diff --git a/lib/classes/record/adapter.php b/lib/classes/record/adapter.php index 9d7beb2c1a..7c91e2e135 100644 --- a/lib/classes/record/adapter.php +++ b/lib/classes/record/adapter.php @@ -19,7 +19,7 @@ use Alchemy\Phrasea\Core\Event\Record\OriginalNameChangedEvent; use Alchemy\Phrasea\Core\Event\Record\RecordEvent; use Alchemy\Phrasea\Core\Event\Record\RecordEvents; use Alchemy\Phrasea\Core\Event\Record\StatusChangedEvent; -use Alchemy\Phrasea\Core\Event\Record\SubdefinitionBuildEvent; +use Alchemy\Phrasea\Core\Event\Record\SubdefinitionCreateEvent; use Alchemy\Phrasea\Core\PhraseaTokens; use Alchemy\Phrasea\Databox\Subdef\MediaSubdefRepository; use Alchemy\Phrasea\Filesystem\FilesystemService; @@ -285,7 +285,7 @@ class record_adapter implements RecordInterface, cache_cacheableInterface $this->getDataboxConnection()->executeUpdate($sql, ['type' => $type, 'record_id' => $this->getRecordId()]); if ($old_type !== $type) { - $this->dispatch(RecordEvents::SUBDEFINITION_BUILD, new SubdefinitionBuildEvent($this)); + $this->dispatch(RecordEvents::SUBDEFINITION_CREATE, new SubdefinitionCreateEvent($this)); } $this->type = $type; @@ -342,7 +342,7 @@ class record_adapter implements RecordInterface, cache_cacheableInterface array(':mime' => $mime, ':record_id' => $this->getRecordId()) )) { - $this->dispatch(RecordEvents::SUBDEFINITION_BUILD, new SubdefinitionBuildEvent($this)); + $this->dispatch(RecordEvents::SUBDEFINITION_CREATE, new SubdefinitionCreateEvent($this)); $this->delete_data_from_cache(); }