diff --git a/lib/Alchemy/Phrasea/Controller/Api/V1.php b/lib/Alchemy/Phrasea/Controller/Api/V1.php index 15f52477d9..683d4644db 100644 --- a/lib/Alchemy/Phrasea/Controller/Api/V1.php +++ b/lib/Alchemy/Phrasea/Controller/Api/V1.php @@ -12,7 +12,7 @@ namespace Alchemy\Phrasea\Controller\Api; use Alchemy\Phrasea\Core\Event\ChangeStatusEvent; -use Alchemy\Phrasea\Core\Event\RecordEvent\ChangeMetadataEvent; +use Alchemy\Phrasea\Core\Event\RecordEvent\RecordMetadataChangedEvent; use Alchemy\Phrasea\Core\Event\RecordEvent\RecordCreatedEvent; use Silex\ControllerProviderInterface; use Alchemy\Phrasea\Cache\Cache as CacheInterface; @@ -833,7 +833,7 @@ class V1 implements ControllerProviderInterface }); $record->set_metadatas($metadatas); - $app['dispatcher']->dispatch(PhraseaEvents::RECORD_CHANGE_METADATA, new ChangeMetadataEvent($record)); + $app['dispatcher']->dispatch(PhraseaEvents::RECORD_METADATA_CHANGED, new RecordMetadataChangedEvent($record)); return Result::create($request, ["record_metadatas" => $this->list_record_caption($record->get_caption())])->createResponse(); } diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Edit.php b/lib/Alchemy/Phrasea/Controller/Prod/Edit.php index 2db3b34742..4b8e125425 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Edit.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Edit.php @@ -11,7 +11,7 @@ namespace Alchemy\Phrasea\Controller\Prod; -use Alchemy\Phrasea\Core\Event\RecordEvent\ChangeMetadataEvent; +use Alchemy\Phrasea\Core\Event\RecordEvent\RecordMetadataChangedEvent; use Alchemy\Phrasea\Core\Event\RecordEvent\ChangeStatusEvent; use Alchemy\Phrasea\Core\PhraseaEvents; use Alchemy\Phrasea\Vocabulary\Controller as VocabularyController; @@ -351,7 +351,7 @@ class Edit implements ControllerProviderInterface if (isset($rec['metadatas']) && is_array($rec['metadatas'])) { $record->set_metadatas($rec['metadatas']); - $app['dispatcher']->dispatch(PhraseaEvents::RECORD_CHANGE_METADATA, new ChangeMetadataEvent($record)); + $app['dispatcher']->dispatch(PhraseaEvents::RECORD_METADATA_CHANGED, new RecordMetadataChangedEvent($record)); } /** @@ -378,7 +378,7 @@ class Edit implements ControllerProviderInterface $record->set_metadatas($metas, true); - $app['dispatcher']->dispatch(PhraseaEvents::RECORD_CHANGE_METADATA, new ChangeMetadataEvent($record)); + $app['dispatcher']->dispatch(PhraseaEvents::RECORD_METADATA_CHANGED, new RecordMetadataChangedEvent($record)); } $newstat = $record->get_status(); diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Lazaret.php b/lib/Alchemy/Phrasea/Controller/Prod/Lazaret.php index 115e77bf03..4d273475f9 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Lazaret.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Lazaret.php @@ -11,7 +11,7 @@ namespace Alchemy\Phrasea\Controller\Prod; -use Alchemy\Phrasea\Core\Event\RecordEvent\ChangeMetadataEvent; +use Alchemy\Phrasea\Core\Event\RecordEvent\RecordMetadataChangedEvent; use Alchemy\Phrasea\Core\Event\RecordEvent\ChangeStatusEvent; use Alchemy\Phrasea\Core\Event\RecordEvent\RecordCreatedEvent; use Alchemy\Phrasea\Core\PhraseaEvents; @@ -248,7 +248,7 @@ class Lazaret implements ControllerProviderInterface $fields = $metaFields->toMetadataArray($record->get_databox()->get_meta_structure()); $record->set_metadatas($fields); - $app['dispatcher']->dispatch(PhraseaEvents::RECORD_CHANGE_METADATA, new ChangeMetadataEvent($record)); + $app['dispatcher']->dispatch(PhraseaEvents::RECORD_METADATA_CHANGED, new RecordMetadataChangedEvent($record)); } //Delete lazaret file diff --git a/lib/Alchemy/Phrasea/Controller/Prod/MoveCollection.php b/lib/Alchemy/Phrasea/Controller/Prod/MoveCollection.php index 6051036c2d..6008934de2 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/MoveCollection.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/MoveCollection.php @@ -12,7 +12,7 @@ namespace Alchemy\Phrasea\Controller\Prod; use Alchemy\Phrasea\Controller\RecordsRequest; -use Alchemy\Phrasea\Core\Event\RecordEvent\ChangeCollectionEvent; +use Alchemy\Phrasea\Core\Event\RecordEvent\RecordCollectionChangedEvent; use Alchemy\Phrasea\Core\PhraseaEvents; use Silex\Application; use Silex\ControllerProviderInterface; @@ -95,7 +95,7 @@ class MoveCollection implements ControllerProviderInterface foreach ($records as $record) { $record->move_to_collection($collection, $app['phraseanet.appbox']); - $app['dispatcher']->dispatch(PhraseaEvents::RECORD_CHANGE_COLLECTION, new ChangeCollectionEvent($record)); + $app['dispatcher']->dispatch(PhraseaEvents::RECORD_COLLECTION_CHANGED, new RecordCollectionChangedEvent($record)); if ($request->request->get("chg_coll_son") == "1") { foreach ($record->get_children() as $child) { @@ -103,7 +103,7 @@ class MoveCollection implements ControllerProviderInterface $child->move_to_collection($collection, $app['phraseanet.appbox']); - $app['dispatcher']->dispatch(PhraseaEvents::RECORD_CHANGE_COLLECTION, new ChangeCollectionEvent($child)); + $app['dispatcher']->dispatch(PhraseaEvents::RECORD_COLLECTION_CHANGED, new RecordCollectionChangedEvent($child)); } } } diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Story.php b/lib/Alchemy/Phrasea/Controller/Prod/Story.php index 48b5f91deb..22dc497cc2 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Story.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Story.php @@ -13,7 +13,7 @@ namespace Alchemy\Phrasea\Controller\Prod; use Alchemy\Phrasea\Controller\Exception as ControllerException; use Alchemy\Phrasea\Controller\RecordsRequest; -use Alchemy\Phrasea\Core\Event\RecordEvent\ChangeMetadataEvent; +use Alchemy\Phrasea\Core\Event\RecordEvent\StoryMetadataChangedEvent; use Alchemy\Phrasea\Core\PhraseaEvents; use Alchemy\Phrasea\Model\Entities\StoryWZ; use Silex\Application; @@ -76,7 +76,7 @@ class Story implements ControllerProviderInterface $Story->set_metadatas($metadatas)->rebuild_subdefs(); - $app['dispatcher']->dispatch(PhraseaEvents::RECORD_CHANGE_METADATA, new ChangeMetadataEvent($Story)); + $app['dispatcher']->dispatch(PhraseaEvents::STORY_METADATA_CHANGED, new StoryMetadataChangedEvent($Story)); $StoryWZ = new StoryWZ(); $StoryWZ->setUser($app['authentication']->getUser()); diff --git a/lib/Alchemy/Phrasea/Controller/Thesaurus/Xmlhttp.php b/lib/Alchemy/Phrasea/Controller/Thesaurus/Xmlhttp.php index a40bdd064f..fd8b1b12e9 100644 --- a/lib/Alchemy/Phrasea/Controller/Thesaurus/Xmlhttp.php +++ b/lib/Alchemy/Phrasea/Controller/Thesaurus/Xmlhttp.php @@ -11,7 +11,7 @@ namespace Alchemy\Phrasea\Controller\Thesaurus; -use Alchemy\Phrasea\Core\Event\RecordEvent\ChangeMetadataEvent; +use Alchemy\Phrasea\Core\Event\RecordEvent\RecordMetadataChangedEvent; use Alchemy\Phrasea\Core\PhraseaEvents; use Alchemy\Phrasea\Model\Entities\User; use Silex\Application; @@ -1497,7 +1497,7 @@ class Xmlhttp implements ControllerProviderInterface if (!$request->get('debug')) { $record->set_metadatas($metadatasd, true); - $app['dispatcher']->dispatch(PhraseaEvents::RECORD_CHANGE_METADATA, new ChangeMetadataEvent($record)); + $app['dispatcher']->dispatch(PhraseaEvents::RECORD_METADATA_CHANGED, new RecordMetadataChangedEvent($record)); $ret['nRecsUpdated']++; } diff --git a/lib/Alchemy/Phrasea/Core/Event/RecordEvent/ChangeMetadataEvent.php b/lib/Alchemy/Phrasea/Core/Event/RecordEvent/RecordCollectionChangedEvent.php similarity index 64% rename from lib/Alchemy/Phrasea/Core/Event/RecordEvent/ChangeMetadataEvent.php rename to lib/Alchemy/Phrasea/Core/Event/RecordEvent/RecordCollectionChangedEvent.php index 82d5270c53..530b5a73c3 100644 --- a/lib/Alchemy/Phrasea/Core/Event/RecordEvent/ChangeMetadataEvent.php +++ b/lib/Alchemy/Phrasea/Core/Event/RecordEvent/RecordCollectionChangedEvent.php @@ -11,9 +11,6 @@ namespace Alchemy\Phrasea\Core\Event\RecordEvent; -use Alchemy\Phrasea\Model\Entities\Basket; -use Symfony\Component\EventDispatcher\Event as SfEvent; - -class ChangeMetadataEvent extends RecordEvent +class RecordCollectionChangedEvent extends RecordEvent { } diff --git a/lib/Alchemy/Phrasea/Core/Event/RecordEvent/ChangeCollectionEvent.php b/lib/Alchemy/Phrasea/Core/Event/RecordEvent/RecordMetadataChangedEvent.php similarity index 63% rename from lib/Alchemy/Phrasea/Core/Event/RecordEvent/ChangeCollectionEvent.php rename to lib/Alchemy/Phrasea/Core/Event/RecordEvent/RecordMetadataChangedEvent.php index 748c9780d0..89071beb42 100644 --- a/lib/Alchemy/Phrasea/Core/Event/RecordEvent/ChangeCollectionEvent.php +++ b/lib/Alchemy/Phrasea/Core/Event/RecordEvent/RecordMetadataChangedEvent.php @@ -11,9 +11,6 @@ namespace Alchemy\Phrasea\Core\Event\RecordEvent; -use Alchemy\Phrasea\Model\Entities\Basket; -use Symfony\Component\EventDispatcher\Event as SfEvent; - -class ChangeCollectionEvent extends RecordEvent +class RecordMetadataChangedEvent extends RecordEvent { } diff --git a/lib/Alchemy/Phrasea/Core/Event/RecordEvent/StoryMetadataChangedEvent.php b/lib/Alchemy/Phrasea/Core/Event/RecordEvent/StoryMetadataChangedEvent.php new file mode 100644 index 0000000000..756f531a0a --- /dev/null +++ b/lib/Alchemy/Phrasea/Core/Event/RecordEvent/StoryMetadataChangedEvent.php @@ -0,0 +1,16 @@ +disptatcher = $dispatcher; + $this->dispatcher = $dispatcher; } public function replaceMetadata($metadataCollection, \record_adapter $record) @@ -102,7 +103,7 @@ class PhraseanetMetadataSetter if (count($metas) > 0) { $record->set_metadatas($metas, true); - $this->disptatcher->dispatch(PhraseaEvents::RECORD_CHANGE_METADATA, new ChangeMetadataEvent($record)); + $this->dispatcher->dispatch(PhraseaEvents::RECORD_METADATA_CHANGED, new RecordMetadataChangedEvent($record)); } } } diff --git a/lib/Alchemy/Phrasea/TaskManager/Job/RecordMoverJob.php b/lib/Alchemy/Phrasea/TaskManager/Job/RecordMoverJob.php index 179f75d9f4..5939a473c9 100644 --- a/lib/Alchemy/Phrasea/TaskManager/Job/RecordMoverJob.php +++ b/lib/Alchemy/Phrasea/TaskManager/Job/RecordMoverJob.php @@ -12,7 +12,7 @@ namespace Alchemy\Phrasea\TaskManager\Job; use Alchemy\Phrasea\Application; -use Alchemy\Phrasea\Core\Event\RecordEvent\ChangeCollectionEvent; +use Alchemy\Phrasea\Core\Event\RecordEvent\RecordCollectionChangedEvent; use Alchemy\Phrasea\Core\Event\RecordEvent\ChangeStatusEvent; use Alchemy\Phrasea\Core\Event\RecordEvent\RecordDeletedEvent; use Alchemy\Phrasea\Core\PhraseaEvents; @@ -84,7 +84,7 @@ class RecordMoverJob extends AbstractJob $coll = \collection::get_from_coll_id($app, $databox, $row['coll']); $rec->move_to_collection($coll, $app['phraseanet.appbox']); - $app['dispatcher']->dispatch(PhraseaEvents::RECORD_CHANGE_COLLECTION, new ChangeCollectionEvent($rec)); + $app['dispatcher']->dispatch(PhraseaEvents::RECORD_COLLECTION_CHANGED, new RecordCollectionChangedEvent($rec)); if ($logsql) { $this->log('debug', sprintf("on sbas %s move rid %s to coll %s \n", $row['sbas_id'], $row['record_id'], $coll->get_coll_id())); diff --git a/lib/classes/caption/field.php b/lib/classes/caption/field.php index 7b65f40d2d..fc49ce8c3f 100644 --- a/lib/classes/caption/field.php +++ b/lib/classes/caption/field.php @@ -10,8 +10,8 @@ */ use Alchemy\Phrasea\Application; +use Alchemy\Phrasea\Core\Event\RecordEvent\RecordMetadataChangedEvent; use Alchemy\Phrasea\Core\PhraseaEvents; -use Alchemy\Phrasea\Core\Event\RecordEvent\ChangeMetadataEvent; use Symfony\Component\EventDispatcher\EventDispatcherInterface; class caption_field implements cache_cacheableInterface @@ -321,7 +321,7 @@ class caption_field implements cache_cacheableInterface $record = $databox_field->get_databox()->get_record($row['record_id']); $record->set_metadatas([]); - $dispatcher->dispatch(PhraseaEvents::RECORD_CHANGE_METADATA, new ChangeMetadataEvent($record)); + $dispatcher->dispatch(PhraseaEvents::RECORD_METADATA_CHANGED, new RecordMetadataChangedEvent($record)); unset($record); } catch (\Exception $e) { @@ -375,7 +375,7 @@ class caption_field implements cache_cacheableInterface $caption_field->delete(); $record->set_metadatas([]); - $app['dispatcher']->dispatch(PhraseaEvents::RECORD_CHANGE_METADATA, new ChangeMetadataEvent($record)); + $app['dispatcher']->dispatch(PhraseaEvents::RECORD_METADATA_CHANGED, new RecordMetadataChangedEvent($record)); unset($caption_field); unset($record); diff --git a/lib/classes/module/console/fieldsMerge.php b/lib/classes/module/console/fieldsMerge.php index a535ff15fa..a8c218e570 100644 --- a/lib/classes/module/console/fieldsMerge.php +++ b/lib/classes/module/console/fieldsMerge.php @@ -14,8 +14,8 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Alchemy\Phrasea\Command\Command; +use Alchemy\Phrasea\Core\Event\RecordEvent\RecordMetadataChangedEvent; use Alchemy\Phrasea\Core\PhraseaEvents; -use Alchemy\Phrasea\Core\Event\RecordEvent\ChangeMetadataEvent; class module_console_fieldsMerge extends Command { @@ -198,7 +198,7 @@ class module_console_fieldsMerge extends Command ]], true); } - $this->getService('dispatcher')->dispatch(PhraseaEvents::RECORD_CHANGE_METADATA, new ChangeMetadataEvent($record)); + $this->getService('dispatcher')->dispatch(PhraseaEvents::RECORD_METADATA_CHANGED, new RecordMetadataChangedEvent($record)); unset($record); }