diff --git a/lib/Alchemy/Phrasea/Border/Manager.php b/lib/Alchemy/Phrasea/Border/Manager.php index dab6c1c026..53d2ab5fa9 100644 --- a/lib/Alchemy/Phrasea/Border/Manager.php +++ b/lib/Alchemy/Phrasea/Border/Manager.php @@ -13,8 +13,8 @@ namespace Alchemy\Phrasea\Border; use Alchemy\Phrasea\Border\Checker\CheckerInterface; use Alchemy\Phrasea\Border\Attribute\AttributeInterface; +use Alchemy\Phrasea\Core\Event\RecordEvent\RecordEvents; use Alchemy\Phrasea\Core\Event\RecordEvent\RecordStatusChangedEvent; -use Alchemy\Phrasea\Core\PhraseaEvents; use Alchemy\Phrasea\Metadata\Tag\TfArchivedate; use Alchemy\Phrasea\Metadata\Tag\TfQuarantine; use Alchemy\Phrasea\Metadata\Tag\TfBasename; @@ -290,7 +290,7 @@ class Manager case AttributeInterface::NAME_STATUS: $element->set_binary_status(decbin(bindec($element->get_status()) | bindec($attribute->getValue()))); - $this->app['dispatcher']->dispatch(PhraseaEvents::RECORD_STATUS_CHANGED, new RecordStatusChangedEvent($element)); + $this->app['dispatcher']->dispatch(RecordEvents::STATUS_CHANGED, new RecordStatusChangedEvent($element)); break; case AttributeInterface::NAME_STORY: diff --git a/lib/Alchemy/Phrasea/Command/RecordAdd.php b/lib/Alchemy/Phrasea/Command/RecordAdd.php index ddcdc4ba2b..e0daa8fa63 100644 --- a/lib/Alchemy/Phrasea/Command/RecordAdd.php +++ b/lib/Alchemy/Phrasea/Command/RecordAdd.php @@ -14,7 +14,7 @@ namespace Alchemy\Phrasea\Command; use Alchemy\Phrasea\Border\File; use Alchemy\Phrasea\Border\Manager; use Alchemy\Phrasea\Core\Event\RecordEvent\RecordCreatedEvent; -use Alchemy\Phrasea\Core\PhraseaEvents; +use Alchemy\Phrasea\Core\Event\RecordEvent\RecordEvents; use Alchemy\Phrasea\Model\Entities\LazaretFile; use Alchemy\Phrasea\Model\Entities\LazaretSession; use Symfony\Component\Console\Input\InputArgument; @@ -117,7 +117,7 @@ class RecordAdd extends Command "Record id %d on collection `%s` (databox `%s`) has been created", $elementCreated->get_record_id(), $elementCreated->get_collection()->get_label($this->container['locale']), $elementCreated->get_databox()->get_label($this->container['locale']) ) ); - $this->container['dispatcher']->dispatch(PhraseaEvents::RECORD_CREATED, new RecordCreatedEvent($elementCreated)); + $this->container['dispatcher']->dispatch(RecordEvents::CREATED, new RecordCreatedEvent($elementCreated)); } elseif ($elementCreated instanceof LazaretFile) { $output->writeln( sprintf("Quarantine item id %d has been created", $elementCreated->getId()) diff --git a/lib/Alchemy/Phrasea/Controller/Api/V1.php b/lib/Alchemy/Phrasea/Controller/Api/V1.php index f073749d07..33dcde4fab 100644 --- a/lib/Alchemy/Phrasea/Controller/Api/V1.php +++ b/lib/Alchemy/Phrasea/Controller/Api/V1.php @@ -12,6 +12,7 @@ namespace Alchemy\Phrasea\Controller\Api; use Alchemy\Phrasea\Core\Event\RecordEvent\RecordCreatedEvent; +use Alchemy\Phrasea\Core\Event\RecordEvent\RecordEvents; use Alchemy\Phrasea\Core\Event\RecordEvent\RecordMetadataChangedEvent; use Alchemy\Phrasea\Core\Event\RecordEvent\RecordStatusChangedEvent; use Silex\ControllerProviderInterface; @@ -562,7 +563,7 @@ class V1 implements ControllerProviderInterface $ret['entity'] = '0'; $ret['url'] = '/records/' . $output->get_sbas_id() . '/' . $output->get_record_id() . '/'; - $app['dispatcher']->dispatch(PhraseaEvents::RECORD_CREATED, new RecordCreatedEvent($output)); + $app['dispatcher']->dispatch(RecordEvents::CREATED, new RecordCreatedEvent($output)); } if ($output instanceof LazaretFile) { $ret['entity'] = '1'; @@ -833,7 +834,7 @@ class V1 implements ControllerProviderInterface }); $record->set_metadatas($metadatas); - $app['dispatcher']->dispatch(PhraseaEvents::RECORD_METADATA_CHANGED, new RecordMetadataChangedEvent($record)); + $app['dispatcher']->dispatch(RecordEvents::METADATA_CHANGED, new RecordMetadataChangedEvent($record)); return Result::create($request, ["record_metadatas" => $this->list_record_caption($record->get_caption())])->createResponse(); } @@ -867,7 +868,7 @@ class V1 implements ControllerProviderInterface $record->set_binary_status(strrev($datas)); - $app['dispatcher']->dispatch(PhraseaEvents::RECORD_STATUS_CHANGED, new RecordStatusChangedEvent($record)); + $app['dispatcher']->dispatch(RecordEvents::STATUS_CHANGED, new RecordStatusChangedEvent($record)); $ret = ["status" => $this->list_record_status($databox, $record->get_status())]; diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Edit.php b/lib/Alchemy/Phrasea/Controller/Prod/Edit.php index 61f7579dda..8457ced404 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Edit.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Edit.php @@ -11,9 +11,9 @@ namespace Alchemy\Phrasea\Controller\Prod; +use Alchemy\Phrasea\Core\Event\RecordEvent\RecordEvents; use Alchemy\Phrasea\Core\Event\RecordEvent\RecordMetadataChangedEvent; use Alchemy\Phrasea\Core\Event\RecordEvent\RecordStatusChangedEvent; -use Alchemy\Phrasea\Core\PhraseaEvents; use Alchemy\Phrasea\Vocabulary\Controller as VocabularyController; use Alchemy\Phrasea\Controller\RecordsRequest; use Alchemy\Phrasea\Metadata\Tag\TfEditdate; @@ -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_METADATA_CHANGED, new RecordMetadataChangedEvent($record)); + $app['dispatcher']->dispatch(RecordEvents::METADATA_CHANGED, new RecordMetadataChangedEvent($record)); } /** @@ -378,7 +378,7 @@ class Edit implements ControllerProviderInterface $record->set_metadatas($metas, true); - $app['dispatcher']->dispatch(PhraseaEvents::RECORD_METADATA_CHANGED, new RecordMetadataChangedEvent($record)); + $app['dispatcher']->dispatch(RecordEvents::METADATA_CHANGED, new RecordMetadataChangedEvent($record)); } $newstat = $record->get_status(); @@ -397,7 +397,7 @@ class Edit implements ControllerProviderInterface $record->set_binary_status($newstat); - $app['dispatcher']->dispatch(PhraseaEvents::RECORD_STATUS_CHANGED, new RecordStatusChangedEvent($record)); + $app['dispatcher']->dispatch(RecordEvents::STATUS_CHANGED, new RecordStatusChangedEvent($record)); } $record diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Lazaret.php b/lib/Alchemy/Phrasea/Controller/Prod/Lazaret.php index 1bd626381c..3e3d840668 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Lazaret.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Lazaret.php @@ -12,6 +12,7 @@ namespace Alchemy\Phrasea\Controller\Prod; use Alchemy\Phrasea\Core\Event\RecordEvent\RecordCreatedEvent; +use Alchemy\Phrasea\Core\Event\RecordEvent\RecordEvents; use Alchemy\Phrasea\Core\Event\RecordEvent\RecordMetadataChangedEvent; use Alchemy\Phrasea\Core\Event\RecordEvent\RecordStatusChangedEvent; use Alchemy\Phrasea\Core\PhraseaEvents; @@ -199,7 +200,7 @@ class Lazaret implements ControllerProviderInterface $lazaretFile->getSession(), $borderFile, $callBack, Border\Manager::FORCE_RECORD ); - $app['dispatcher']->dispatch(PhraseaEvents::RECORD_CREATED, new RecordCreatedEvent($record)); + $app['dispatcher']->dispatch(RecordEvents::CREATED, new RecordCreatedEvent($record)); if ($keepAttributes) { //add attribute @@ -234,7 +235,7 @@ class Lazaret implements ControllerProviderInterface case AttributeInterface::NAME_STATUS: $record->set_binary_status($attribute->getValue()); - $app['dispatcher']->dispatch(PhraseaEvents::RECORD_STATUS_CHANGED, new RecordStatusChangedEvent($record)); + $app['dispatcher']->dispatch(RecordEvents::STATUS_CHANGED, new RecordStatusChangedEvent($record)); break; case AttributeInterface::NAME_METAFIELD: $metaFields->set($attribute->getField()->get_name(), $attribute->getValue()); @@ -248,7 +249,7 @@ class Lazaret implements ControllerProviderInterface $fields = $metaFields->toMetadataArray($record->get_databox()->get_meta_structure()); $record->set_metadatas($fields); - $app['dispatcher']->dispatch(PhraseaEvents::RECORD_METADATA_CHANGED, new RecordMetadataChangedEvent($record)); + $app['dispatcher']->dispatch(RecordEvents::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 6008934de2..1711d0608b 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/MoveCollection.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/MoveCollection.php @@ -13,7 +13,7 @@ namespace Alchemy\Phrasea\Controller\Prod; use Alchemy\Phrasea\Controller\RecordsRequest; use Alchemy\Phrasea\Core\Event\RecordEvent\RecordCollectionChangedEvent; -use Alchemy\Phrasea\Core\PhraseaEvents; +use Alchemy\Phrasea\Core\Event\RecordEvent\RecordEvents; use Silex\Application; use Silex\ControllerProviderInterface; use Symfony\Component\HttpFoundation\Request; @@ -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_COLLECTION_CHANGED, new RecordCollectionChangedEvent($record)); + $app['dispatcher']->dispatch(RecordEvents::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_COLLECTION_CHANGED, new RecordCollectionChangedEvent($child)); + $app['dispatcher']->dispatch(RecordEvents::COLLECTION_CHANGED, new RecordCollectionChangedEvent($child)); } } } diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Property.php b/lib/Alchemy/Phrasea/Controller/Prod/Property.php index 1cc991b42e..5d4861c41b 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Property.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Property.php @@ -12,8 +12,8 @@ namespace Alchemy\Phrasea\Controller\Prod; use Alchemy\Phrasea\Controller\RecordsRequest; +use Alchemy\Phrasea\Core\Event\RecordEvent\RecordEvents; use Alchemy\Phrasea\Core\Event\RecordEvent\RecordStatusChangedEvent; -use Alchemy\Phrasea\Core\PhraseaEvents; use Silex\Application; use Silex\ControllerProviderInterface; use Symfony\Component\HttpFoundation\JsonResponse; @@ -177,7 +177,7 @@ class Property implements ControllerProviderInterface foreach ($record->get_children() as $child) { if (null !== $updatedStatus = $this->updateRecordStatus($child, $postStatus)) { $updated[$record->get_serialize_key()] = $updatedStatus; - $app['dispatcher']->dispatch(PhraseaEvents::RECORD_STATUS_CHANGED, new RecordStatusChangedEvent($record)); + $app['dispatcher']->dispatch(RecordEvents::STATUS_CHANGED, new RecordStatusChangedEvent($record)); } } } diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Records.php b/lib/Alchemy/Phrasea/Controller/Prod/Records.php index 8dc3c8322b..3621fd97d3 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Records.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Records.php @@ -13,6 +13,7 @@ namespace Alchemy\Phrasea\Controller\Prod; use Alchemy\Phrasea\Controller\RecordsRequest; use Alchemy\Phrasea\Core\Event\RecordEvent\RecordDeletedEvent; +use Alchemy\Phrasea\Core\Event\RecordEvent\RecordEvents; use Alchemy\Phrasea\Core\Event\RecordEvent\StoryDeletedEvent; use Alchemy\Phrasea\Core\PhraseaEvents; use Alchemy\Phrasea\SearchEngine\SearchEngineOptions; @@ -181,7 +182,7 @@ class Records implements ControllerProviderInterface if ($record->isStory()) { $app['dispatcher']->dispatch(PhraseaEvents::STORY_DELETED, new StoryDeletedEvent($record)); } else { - $app['dispatcher']->dispatch(PhraseaEvents::RECORD_DELETED, new RecordDeletedEvent($record)); + $app['dispatcher']->dispatch(RecordEvents::DELETED, new RecordDeletedEvent($record)); } } catch (\Exception $e) { diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Tools.php b/lib/Alchemy/Phrasea/Controller/Prod/Tools.php index 47de30add4..6683e53529 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Tools.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Tools.php @@ -12,8 +12,8 @@ namespace Alchemy\Phrasea\Controller\Prod; use Alchemy\Phrasea\Controller\RecordsRequest; -use Alchemy\Phrasea\Core\Event\RecordOriginalNameChangedEvent; -use Alchemy\Phrasea\Core\PhraseaEvents; +use Alchemy\Phrasea\Core\Event\RecordEvent\RecordEvents; +use Alchemy\Phrasea\Core\Event\RecordEvent\RecordOriginalNameChangedEvent; use Alchemy\Phrasea\Exception\RuntimeException; use DataURI; use PHPExiftool\Exception\ExceptionInterface as PHPExiftoolException; @@ -152,7 +152,7 @@ class Tools implements ControllerProviderInterface if ((int) $request->request->get('ccfilename') === 1) { $record->set_original_name($fileName); - $app['dispatcher']->dispatch(PhraseaEvents::RECORD_ORIGINAL_NAME_CHANGED, new RecordOriginalNameChangedEvent($record)); + $app['dispatcher']->dispatch(RecordEvents::ORIGINAL_NAME_CHANGED, new RecordOriginalNameChangedEvent($record)); } unlink($tempoFile); rmdir($tempoDir); diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Upload.php b/lib/Alchemy/Phrasea/Controller/Prod/Upload.php index ea61bb3d79..b14503a262 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Upload.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Upload.php @@ -15,6 +15,7 @@ use Alchemy\Phrasea\Border\File; use Alchemy\Phrasea\Border\Attribute\Status; use Alchemy\Phrasea\Core\Event\LazaretEvent; use Alchemy\Phrasea\Core\Event\RecordEvent\RecordCreatedEvent; +use Alchemy\Phrasea\Core\Event\RecordEvent\RecordEvents; use Alchemy\Phrasea\Core\PhraseaEvents; use DataURI\Parser; use DataURI\Exception\Exception as DataUriException; @@ -209,7 +210,7 @@ class Upload implements ControllerProviderInterface $element = 'record'; $message = $app->trans('The record was successfully created'); - $app['dispatcher']->dispatch(PhraseaEvents::RECORD_CREATED, new RecordCreatedEvent($elementCreated)); + $app['dispatcher']->dispatch(RecordEvents::CREATED, new RecordCreatedEvent($elementCreated)); // try to create thumbnail from data URI if ('' !== $b64Image = $request->request->get('b64_image', '')) { diff --git a/lib/Alchemy/Phrasea/Controller/Thesaurus/Xmlhttp.php b/lib/Alchemy/Phrasea/Controller/Thesaurus/Xmlhttp.php index fd8b1b12e9..caf468e3ad 100644 --- a/lib/Alchemy/Phrasea/Controller/Thesaurus/Xmlhttp.php +++ b/lib/Alchemy/Phrasea/Controller/Thesaurus/Xmlhttp.php @@ -12,7 +12,7 @@ namespace Alchemy\Phrasea\Controller\Thesaurus; use Alchemy\Phrasea\Core\Event\RecordEvent\RecordMetadataChangedEvent; -use Alchemy\Phrasea\Core\PhraseaEvents; +use Alchemy\Phrasea\Core\Event\RecordEvent\RecordEvents; use Alchemy\Phrasea\Model\Entities\User; use Silex\Application; use Silex\ControllerProviderInterface; @@ -1497,7 +1497,7 @@ class Xmlhttp implements ControllerProviderInterface if (!$request->get('debug')) { $record->set_metadatas($metadatasd, true); - $app['dispatcher']->dispatch(PhraseaEvents::RECORD_METADATA_CHANGED, new RecordMetadataChangedEvent($record)); + $app['dispatcher']->dispatch(RecordEvents::METADATA_CHANGED, new RecordMetadataChangedEvent($record)); $ret['nRecsUpdated']++; } diff --git a/lib/Alchemy/Phrasea/Core/Event/RecordEvent/RecordEvents.php b/lib/Alchemy/Phrasea/Core/Event/RecordEvent/RecordEvents.php new file mode 100644 index 0000000000..f1031fb50c --- /dev/null +++ b/lib/Alchemy/Phrasea/Core/Event/RecordEvent/RecordEvents.php @@ -0,0 +1,26 @@ +clearSubdefCache($subdefname); - $this->app['dispatcher']->dispatch(PhraseaEvents::RECORD_SUB_DEFINITION_CREATED, new RecordSubDefinitionCreatedEvent($record, $subDefName)); + $this->app['dispatcher']->dispatch(RecordEvents::SUB_DEFINITION_CREATED, new RecordSubDefinitionCreatedEvent($record, $subDefName)); } return $this; diff --git a/lib/Alchemy/Phrasea/Media/SubdefSubstituer.php b/lib/Alchemy/Phrasea/Media/SubdefSubstituer.php index 59df9ae5a9..4518e3bbda 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\RecordEvent\RecordMediaSubstitutedEvent; -use Alchemy\Phrasea\Core\PhraseaEvents; +use Alchemy\Phrasea\Core\Event\RecordEvent\RecordEvents; use MediaAlchemyst\Alchemyst; use MediaAlchemyst\Exception\ExceptionInterface as MediaAlchemystException; use MediaVorus\Media\MediaInterface; @@ -97,6 +97,6 @@ class SubdefSubstituer $record->rebuild_subdefs(); } - $this->dispatcher->dispatch(PhraseaEvents::RECORD_SUB_DEFINITION_SUBSTITUTED, new RecordMediaSubstitutedEvent($record)); + $this->dispatcher->dispatch(RecordEvents::SUB_DEFINITION_SUBSTITUTED, new RecordMediaSubstitutedEvent($record)); } } diff --git a/lib/Alchemy/Phrasea/Metadata/PhraseanetMetadataSetter.php b/lib/Alchemy/Phrasea/Metadata/PhraseanetMetadataSetter.php index 16c803c09a..d10d2cf1ae 100644 --- a/lib/Alchemy/Phrasea/Metadata/PhraseanetMetadataSetter.php +++ b/lib/Alchemy/Phrasea/Metadata/PhraseanetMetadataSetter.php @@ -11,6 +11,7 @@ namespace Alchemy\Phrasea\Metadata; +use Alchemy\Phrasea\Core\Event\RecordEvent\RecordEvents; use Alchemy\Phrasea\Core\Event\RecordEvent\RecordMetadataChangedEvent; use PHPExiftool\Driver\Metadata\Metadata; use Symfony\Component\EventDispatcher\EventDispatcherInterface; @@ -103,7 +104,7 @@ class PhraseanetMetadataSetter if (count($metas) > 0) { $record->set_metadatas($metas, true); - $this->dispatcher->dispatch(PhraseaEvents::RECORD_METADATA_CHANGED, new RecordMetadataChangedEvent($record)); + $this->dispatcher->dispatch(RecordEvents::METADATA_CHANGED, new RecordMetadataChangedEvent($record)); } } } diff --git a/lib/Alchemy/Phrasea/TaskManager/Job/RecordMoverJob.php b/lib/Alchemy/Phrasea/TaskManager/Job/RecordMoverJob.php index afbfa9b492..a62a283510 100644 --- a/lib/Alchemy/Phrasea/TaskManager/Job/RecordMoverJob.php +++ b/lib/Alchemy/Phrasea/TaskManager/Job/RecordMoverJob.php @@ -14,6 +14,7 @@ namespace Alchemy\Phrasea\TaskManager\Job; use Alchemy\Phrasea\Application; use Alchemy\Phrasea\Core\Event\RecordEvent\RecordCollectionChangedEvent; use Alchemy\Phrasea\Core\Event\RecordEvent\RecordDeletedEvent; +use Alchemy\Phrasea\Core\Event\RecordEvent\RecordEvents; use Alchemy\Phrasea\Core\Event\RecordEvent\RecordStatusChangedEvent; use Alchemy\Phrasea\Core\PhraseaEvents; use Alchemy\Phrasea\TaskManager\Editor\RecordMoverEditor; @@ -84,7 +85,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_COLLECTION_CHANGED, new RecordCollectionChangedEvent($rec)); + $app['dispatcher']->dispatch(RecordEvents::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())); @@ -101,7 +102,7 @@ class RecordMoverJob extends AbstractJob } $rec->set_binary_status(implode('', $status)); - $app['dispatcher']->dispatch(PhraseaEvents::RECORD_STATUS_CHANGED, new RecordStatusChangedEvent($rec)); + $app['dispatcher']->dispatch(RecordEvents::STATUS_CHANGED, new RecordStatusChangedEvent($rec)); if ($logsql) { $this->log('debug', sprintf("on sbas %s set rid %s status to %s \n", $row['sbas_id'], $row['record_id'], $status)); @@ -114,7 +115,7 @@ class RecordMoverJob extends AbstractJob foreach ($rec->get_children() as $child) { $child->delete(); - $app['dispatcher']->dispatch(PhraseaEvents::RECORD_DELETED, new RecordDeletedEvent($child)); + $app['dispatcher']->dispatch(RecordEvents::DELETED, new RecordDeletedEvent($child)); if ($logsql) { $this->log('debug', sprintf("on sbas %s delete (grp child) rid %s \n", $row['sbas_id'], $child->get_record_id())); @@ -122,7 +123,7 @@ class RecordMoverJob extends AbstractJob } } $rec->delete(); - $app['dispatcher']->dispatch(PhraseaEvents::RECORD_DELETED, new RecordDeletedEvent($rec)); + $app['dispatcher']->dispatch(RecordEvents::DELETED, new RecordDeletedEvent($rec)); if ($logsql) { $this->log('debug', sprintf("on sbas %s delete rid %s \n", $row['sbas_id'], $rec->get_record_id())); } diff --git a/lib/classes/caption/field.php b/lib/classes/caption/field.php index fc49ce8c3f..1e9758ad00 100644 --- a/lib/classes/caption/field.php +++ b/lib/classes/caption/field.php @@ -11,7 +11,7 @@ use Alchemy\Phrasea\Application; use Alchemy\Phrasea\Core\Event\RecordEvent\RecordMetadataChangedEvent; -use Alchemy\Phrasea\Core\PhraseaEvents; +use Alchemy\Phrasea\Core\Event\RecordEvent\RecordEvents; 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_METADATA_CHANGED, new RecordMetadataChangedEvent($record)); + $dispatcher->dispatch(RecordEvents::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_METADATA_CHANGED, new RecordMetadataChangedEvent($record)); + $app['dispatcher']->dispatch(RecordEvents::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 a8c218e570..a7015ef42e 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\RecordEvents; use Alchemy\Phrasea\Core\Event\RecordEvent\RecordMetadataChangedEvent; -use Alchemy\Phrasea\Core\PhraseaEvents; class module_console_fieldsMerge extends Command { @@ -198,7 +198,7 @@ class module_console_fieldsMerge extends Command ]], true); } - $this->getService('dispatcher')->dispatch(PhraseaEvents::RECORD_METADATA_CHANGED, new RecordMetadataChangedEvent($record)); + $this->getService('dispatcher')->dispatch(RecordEvents::METADATA_CHANGED, new RecordMetadataChangedEvent($record)); unset($record); }