diff --git a/lib/Alchemy/Phrasea/Border/Manager.php b/lib/Alchemy/Phrasea/Border/Manager.php index 53d2ab5fa9..4cbc409fa7 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\Event\Record\RecordEvents; +use Alchemy\Phrasea\Core\Event\Record\RecordStatusChangedEvent; use Alchemy\Phrasea\Metadata\Tag\TfArchivedate; use Alchemy\Phrasea\Metadata\Tag\TfQuarantine; use Alchemy\Phrasea\Metadata\Tag\TfBasename; diff --git a/lib/Alchemy/Phrasea/Command/RecordAdd.php b/lib/Alchemy/Phrasea/Command/RecordAdd.php index e0daa8fa63..ddcdba6f95 100644 --- a/lib/Alchemy/Phrasea/Command/RecordAdd.php +++ b/lib/Alchemy/Phrasea/Command/RecordAdd.php @@ -13,8 +13,8 @@ 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\Event\RecordEvent\RecordEvents; +use Alchemy\Phrasea\Core\Event\Record\RecordCreatedEvent; +use Alchemy\Phrasea\Core\Event\Record\RecordEvents; use Alchemy\Phrasea\Model\Entities\LazaretFile; use Alchemy\Phrasea\Model\Entities\LazaretSession; use Symfony\Component\Console\Input\InputArgument; diff --git a/lib/Alchemy/Phrasea/Controller/Admin/Fields.php b/lib/Alchemy/Phrasea/Controller/Admin/Fields.php index 339e019522..3e71a750f9 100644 --- a/lib/Alchemy/Phrasea/Controller/Admin/Fields.php +++ b/lib/Alchemy/Phrasea/Controller/Admin/Fields.php @@ -11,9 +11,6 @@ namespace Alchemy\Phrasea\Controller\Admin; -use Alchemy\Phrasea\Core\Event\DataboxEvent\UpdateStructureFieldEvent; -use Alchemy\Phrasea\Core\Event\DataboxEvent\DeleteStructureFieldEvent; -use Alchemy\Phrasea\Core\PhraseaEvents; use Alchemy\Phrasea\Metadata\TagProvider; use Alchemy\Phrasea\Vocabulary\Controller as VocabularyController; use JMS\TranslationBundle\Annotation\Ignore; @@ -117,8 +114,6 @@ class Fields implements ControllerProviderInterface $this->updateFieldWithData($app, $field, $jsonField); $field->save(); $fields[] = $field->toArray(); - - $app['dispatcher']->dispatch(PhraseaEvents::DATABOX_UPDATE_FIELD, new UpdateStructureFieldEvent($field, $jsonField)); } catch (\Exception $e) { $connection->rollback(); $app->abort(500, $app->trans('Field %name% could not be saved, please try again or contact an admin.', ['%name%' => $jsonField['name']])); @@ -283,8 +278,6 @@ class Fields implements ControllerProviderInterface $this->updateFieldWithData($app, $field, $data); $field->save(); - $app['dispatcher']->dispatch(PhraseaEvents::DATABOX_UPDATE_FIELD, new UpdateStructureFieldEvent($databox, $field, $jsonField)); - return $app->json($field->toArray()); } @@ -294,8 +287,6 @@ class Fields implements ControllerProviderInterface $field = \databox_field::get_instance($app, $databox, $id); $field->delete(); - $app['dispatcher']->dispatch(PhraseaEvents::DATABOX_DELETE_FIELD, new DeleteStructureFieldEvent($databox, $field)); - return new Response('', 204); } @@ -331,7 +322,6 @@ class Fields implements ControllerProviderInterface private function updateFieldWithData(Application $app, \databox_field $field, array $data) { - $field ->set_name($data['name']) ->set_thumbtitle($data['thumbtitle']) diff --git a/lib/Alchemy/Phrasea/Controller/Admin/Root.php b/lib/Alchemy/Phrasea/Controller/Admin/Root.php index ee486062b2..8379fca5cd 100644 --- a/lib/Alchemy/Phrasea/Controller/Admin/Root.php +++ b/lib/Alchemy/Phrasea/Controller/Admin/Root.php @@ -11,9 +11,6 @@ namespace Alchemy\Phrasea\Controller\Admin; -use Alchemy\Phrasea\Core\Event\DataboxEvent\DeleteStatusEvent; -use Alchemy\Phrasea\Core\Event\DataboxEvent\UpdateStatusEvent; -use Alchemy\Phrasea\Core\PhraseaEvents; use Alchemy\Phrasea\Exception\SessionNotFound; use Alchemy\Phrasea\Helper\DatabaseHelper; use Alchemy\Phrasea\Helper\PathHelper; @@ -325,17 +322,12 @@ class Root implements ControllerProviderInterface $error = false; - $status = \databox_status::getStatus($app, $databox_id)[$bit]; - $databox = $app['phraseanet.appbox']->get_databox((int) $databox_id); - try { \databox_status::deleteStatus($app, $app['phraseanet.appbox']->get_databox($databox_id), $bit); } catch (\Exception $e) { $error = true; } - $app['dispatcher']->dispatch(PhraseaEvents::DATABOX_DELETE_STATUS, new DeleteStatusEvent($databox, $status)); - return $app->json(['success' => !$error]); }) ->bind('admin_statusbit_delete') @@ -357,8 +349,6 @@ class Root implements ControllerProviderInterface 'labels_off' => $request->request->get('labels_off', []), ]; - $databox = $app['phraseanet.appbox']->get_databox((int) $databox_id); - \databox_status::updateStatus($app, $databox_id, $bit, $properties); if (null !== $request->request->get('delete_icon_off')) { @@ -453,10 +443,6 @@ class Root implements ControllerProviderInterface } } - $status = \databox_status::getStatus($app, $databox_id)[$bit]; - - $app['dispatcher']->dispatch(PhraseaEvents::DATABOX_UPDATE_STATUS, new UpdateStatusEvent($databox, $status)); - return $app->redirectPath('database_display_statusbit', ['databox_id' => $databox_id, 'success' => 1]); })->assert('databox_id', '\d+') ->assert('bit', '\d+') diff --git a/lib/Alchemy/Phrasea/Controller/Api/V1.php b/lib/Alchemy/Phrasea/Controller/Api/V1.php index 33dcde4fab..2005794bd3 100644 --- a/lib/Alchemy/Phrasea/Controller/Api/V1.php +++ b/lib/Alchemy/Phrasea/Controller/Api/V1.php @@ -11,10 +11,10 @@ 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 Alchemy\Phrasea\Core\Event\Record\RecordCreatedEvent; +use Alchemy\Phrasea\Core\Event\Record\RecordEvents; +use Alchemy\Phrasea\Core\Event\Record\RecordMetadataChangedEvent; +use Alchemy\Phrasea\Core\Event\Record\RecordStatusChangedEvent; use Silex\ControllerProviderInterface; use Alchemy\Phrasea\Cache\Cache as CacheInterface; use Alchemy\Phrasea\Core\PhraseaEvents; diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Edit.php b/lib/Alchemy/Phrasea/Controller/Prod/Edit.php index 8457ced404..ac787fd4c7 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\Event\Record\RecordEvents; +use Alchemy\Phrasea\Core\Event\Record\RecordMetadataChangedEvent; +use Alchemy\Phrasea\Core\Event\Record\RecordStatusChangedEvent; use Alchemy\Phrasea\Vocabulary\Controller as VocabularyController; use Alchemy\Phrasea\Controller\RecordsRequest; use Alchemy\Phrasea\Metadata\Tag\TfEditdate; diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Lazaret.php b/lib/Alchemy/Phrasea/Controller/Prod/Lazaret.php index 3e3d840668..d9dc271367 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Lazaret.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Lazaret.php @@ -11,10 +11,10 @@ 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\Event\Record\RecordCreatedEvent; +use Alchemy\Phrasea\Core\Event\Record\RecordEvents; +use Alchemy\Phrasea\Core\Event\Record\RecordMetadataChangedEvent; +use Alchemy\Phrasea\Core\Event\Record\RecordStatusChangedEvent; use Alchemy\Phrasea\Core\PhraseaEvents; use Alchemy\Phrasea\Model\Entities\LazaretFile; use Alchemy\Phrasea\Border; diff --git a/lib/Alchemy/Phrasea/Controller/Prod/MoveCollection.php b/lib/Alchemy/Phrasea/Controller/Prod/MoveCollection.php index 1711d0608b..e3bbfafd0a 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/MoveCollection.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/MoveCollection.php @@ -12,8 +12,8 @@ namespace Alchemy\Phrasea\Controller\Prod; use Alchemy\Phrasea\Controller\RecordsRequest; -use Alchemy\Phrasea\Core\Event\RecordEvent\RecordCollectionChangedEvent; -use Alchemy\Phrasea\Core\Event\RecordEvent\RecordEvents; +use Alchemy\Phrasea\Core\Event\Record\RecordCollectionChangedEvent; +use Alchemy\Phrasea\Core\Event\Record\RecordEvents; use Silex\Application; use Silex\ControllerProviderInterface; use Symfony\Component\HttpFoundation\Request; diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Property.php b/lib/Alchemy/Phrasea/Controller/Prod/Property.php index 5d4861c41b..4b36461aa5 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\Event\Record\RecordEvents; +use Alchemy\Phrasea\Core\Event\Record\RecordStatusChangedEvent; use Silex\Application; use Silex\ControllerProviderInterface; use Symfony\Component\HttpFoundation\JsonResponse; diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Records.php b/lib/Alchemy/Phrasea/Controller/Prod/Records.php index 9bdc1bc106..d1e7eae269 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Records.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Records.php @@ -12,8 +12,8 @@ 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\Record\RecordDeletedEvent; +use Alchemy\Phrasea\Core\Event\Record\RecordEvents; use Alchemy\Phrasea\SearchEngine\SearchEngineOptions; use Silex\Application; use Silex\ControllerProviderInterface; diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Story.php b/lib/Alchemy/Phrasea/Controller/Prod/Story.php index d3ea669d3d..894416bdd3 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Story.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Story.php @@ -13,8 +13,8 @@ namespace Alchemy\Phrasea\Controller\Prod; use Alchemy\Phrasea\Controller\Exception as ControllerException; use Alchemy\Phrasea\Controller\RecordsRequest; -use Alchemy\Phrasea\Core\Event\RecordEvent\RecordEvents; -use Alchemy\Phrasea\Core\Event\RecordEvent\RecordMetadataChangedEvent; +use Alchemy\Phrasea\Core\Event\Record\RecordEvents; +use Alchemy\Phrasea\Core\Event\Record\RecordMetadataChangedEvent; use Alchemy\Phrasea\Model\Entities\StoryWZ; use Silex\Application; use Silex\ControllerProviderInterface; diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Tools.php b/lib/Alchemy/Phrasea/Controller/Prod/Tools.php index 6683e53529..c2b13949e7 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\RecordEvent\RecordEvents; -use Alchemy\Phrasea\Core\Event\RecordEvent\RecordOriginalNameChangedEvent; +use Alchemy\Phrasea\Core\Event\Record\RecordEvents; +use Alchemy\Phrasea\Core\Event\Record\RecordOriginalNameChangedEvent; use Alchemy\Phrasea\Exception\RuntimeException; use DataURI; use PHPExiftool\Exception\ExceptionInterface as PHPExiftoolException; diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Upload.php b/lib/Alchemy/Phrasea/Controller/Prod/Upload.php index b14503a262..665410e89b 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Upload.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Upload.php @@ -14,8 +14,8 @@ namespace Alchemy\Phrasea\Controller\Prod; 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\Event\Record\RecordCreatedEvent; +use Alchemy\Phrasea\Core\Event\Record\RecordEvents; use Alchemy\Phrasea\Core\PhraseaEvents; use DataURI\Parser; use DataURI\Exception\Exception as DataUriException; diff --git a/lib/Alchemy/Phrasea/Controller/Thesaurus/Xmlhttp.php b/lib/Alchemy/Phrasea/Controller/Thesaurus/Xmlhttp.php index caf468e3ad..3bbefe51c5 100644 --- a/lib/Alchemy/Phrasea/Controller/Thesaurus/Xmlhttp.php +++ b/lib/Alchemy/Phrasea/Controller/Thesaurus/Xmlhttp.php @@ -11,8 +11,8 @@ namespace Alchemy\Phrasea\Controller\Thesaurus; -use Alchemy\Phrasea\Core\Event\RecordEvent\RecordMetadataChangedEvent; -use Alchemy\Phrasea\Core\Event\RecordEvent\RecordEvents; +use Alchemy\Phrasea\Core\Event\Record\RecordMetadataChangedEvent; +use Alchemy\Phrasea\Core\Event\Record\RecordEvents; use Alchemy\Phrasea\Model\Entities\User; use Silex\Application; use Silex\ControllerProviderInterface; diff --git a/lib/Alchemy/Phrasea/Core/Event/DataboxEvent/DeleteStatusEvent.php b/lib/Alchemy/Phrasea/Core/Event/DataboxEvent/DeleteStatusEvent.php deleted file mode 100644 index 1fd7a30632..0000000000 --- a/lib/Alchemy/Phrasea/Core/Event/DataboxEvent/DeleteStatusEvent.php +++ /dev/null @@ -1,29 +0,0 @@ -status = $status; - - parent::__construct($databox); - } - - public function getStatus() - { - return $this->status; - } -} diff --git a/lib/Alchemy/Phrasea/Core/Event/DataboxEvent/UpdateStructureFieldEvent.php b/lib/Alchemy/Phrasea/Core/Event/DataboxEvent/UpdateStructureFieldEvent.php deleted file mode 100644 index a04b65134b..0000000000 --- a/lib/Alchemy/Phrasea/Core/Event/DataboxEvent/UpdateStructureFieldEvent.php +++ /dev/null @@ -1,42 +0,0 @@ -field = $field; - $this->data = $data; - - parent::__construct($databox); - } - - /** - * @return \databox_field - */ - public function getField() - { - return $this->field; - } - - /** - * @return array - */ - public function getData() - { - return $this->data; - } -} diff --git a/lib/Alchemy/Phrasea/Core/Event/RecordEvent/RecordCollectionChangedEvent.php b/lib/Alchemy/Phrasea/Core/Event/Record/RecordCollectionChangedEvent.php similarity index 84% rename from lib/Alchemy/Phrasea/Core/Event/RecordEvent/RecordCollectionChangedEvent.php rename to lib/Alchemy/Phrasea/Core/Event/Record/RecordCollectionChangedEvent.php index 530b5a73c3..85294fb5fc 100644 --- a/lib/Alchemy/Phrasea/Core/Event/RecordEvent/RecordCollectionChangedEvent.php +++ b/lib/Alchemy/Phrasea/Core/Event/Record/RecordCollectionChangedEvent.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Alchemy\Phrasea\Core\Event\RecordEvent; +namespace Alchemy\Phrasea\Core\Event\Record; class RecordCollectionChangedEvent extends RecordEvent { diff --git a/lib/Alchemy/Phrasea/Core/Event/RecordEvent/RecordCreatedEvent.php b/lib/Alchemy/Phrasea/Core/Event/Record/RecordCreatedEvent.php similarity index 83% rename from lib/Alchemy/Phrasea/Core/Event/RecordEvent/RecordCreatedEvent.php rename to lib/Alchemy/Phrasea/Core/Event/Record/RecordCreatedEvent.php index 06a6486710..3cdac78aab 100644 --- a/lib/Alchemy/Phrasea/Core/Event/RecordEvent/RecordCreatedEvent.php +++ b/lib/Alchemy/Phrasea/Core/Event/Record/RecordCreatedEvent.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Alchemy\Phrasea\Core\Event\RecordEvent; +namespace Alchemy\Phrasea\Core\Event\Record; class RecordCreatedEvent extends RecordEvent {} diff --git a/lib/Alchemy/Phrasea/Core/Event/RecordEvent/RecordDeletedEvent.php b/lib/Alchemy/Phrasea/Core/Event/Record/RecordDeletedEvent.php similarity index 83% rename from lib/Alchemy/Phrasea/Core/Event/RecordEvent/RecordDeletedEvent.php rename to lib/Alchemy/Phrasea/Core/Event/Record/RecordDeletedEvent.php index c49b8c9fe4..0f720c07d3 100644 --- a/lib/Alchemy/Phrasea/Core/Event/RecordEvent/RecordDeletedEvent.php +++ b/lib/Alchemy/Phrasea/Core/Event/Record/RecordDeletedEvent.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Alchemy\Phrasea\Core\Event\RecordEvent; +namespace Alchemy\Phrasea\Core\Event\Record; class RecordDeletedEvent extends RecordEvent { diff --git a/lib/Alchemy/Phrasea/Core/Event/RecordEvent/RecordEvent.php b/lib/Alchemy/Phrasea/Core/Event/Record/RecordEvent.php similarity index 91% rename from lib/Alchemy/Phrasea/Core/Event/RecordEvent/RecordEvent.php rename to lib/Alchemy/Phrasea/Core/Event/Record/RecordEvent.php index 0f0558b680..a0355f2968 100644 --- a/lib/Alchemy/Phrasea/Core/Event/RecordEvent/RecordEvent.php +++ b/lib/Alchemy/Phrasea/Core/Event/Record/RecordEvent.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Alchemy\Phrasea\Core\Event\RecordEvent; +namespace Alchemy\Phrasea\Core\Event\Record; use Alchemy\Phrasea\Model\RecordInterface; use Symfony\Component\EventDispatcher\Event; diff --git a/lib/Alchemy/Phrasea/Core/Event/RecordEvent/RecordEvents.php b/lib/Alchemy/Phrasea/Core/Event/Record/RecordEvents.php similarity index 93% rename from lib/Alchemy/Phrasea/Core/Event/RecordEvent/RecordEvents.php rename to lib/Alchemy/Phrasea/Core/Event/Record/RecordEvents.php index f1031fb50c..1c117cab28 100644 --- a/lib/Alchemy/Phrasea/Core/Event/RecordEvent/RecordEvents.php +++ b/lib/Alchemy/Phrasea/Core/Event/Record/RecordEvents.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Alchemy\Phrasea\Core\Event\RecordEvent; +namespace Alchemy\Phrasea\Core\Event\Record; final class RecordEvents { diff --git a/lib/Alchemy/Phrasea/Core/Event/RecordEvent/RecordIndexEvent.php b/lib/Alchemy/Phrasea/Core/Event/Record/RecordIndexEvent.php similarity index 83% rename from lib/Alchemy/Phrasea/Core/Event/RecordEvent/RecordIndexEvent.php rename to lib/Alchemy/Phrasea/Core/Event/Record/RecordIndexEvent.php index 6f1a7e4f0b..1a0e4a9ba4 100644 --- a/lib/Alchemy/Phrasea/Core/Event/RecordEvent/RecordIndexEvent.php +++ b/lib/Alchemy/Phrasea/Core/Event/Record/RecordIndexEvent.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Alchemy\Phrasea\Core\Event\RecordEvent; +namespace Alchemy\Phrasea\Core\Event\Record; class RecordIndexEvent extends RecordEvent { diff --git a/lib/Alchemy/Phrasea/Core/Event/RecordEvent/RecordMetadataChangedEvent.php b/lib/Alchemy/Phrasea/Core/Event/Record/RecordMetadataChangedEvent.php similarity index 84% rename from lib/Alchemy/Phrasea/Core/Event/RecordEvent/RecordMetadataChangedEvent.php rename to lib/Alchemy/Phrasea/Core/Event/Record/RecordMetadataChangedEvent.php index 89071beb42..4cd755d721 100644 --- a/lib/Alchemy/Phrasea/Core/Event/RecordEvent/RecordMetadataChangedEvent.php +++ b/lib/Alchemy/Phrasea/Core/Event/Record/RecordMetadataChangedEvent.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Alchemy\Phrasea\Core\Event\RecordEvent; +namespace Alchemy\Phrasea\Core\Event\Record; class RecordMetadataChangedEvent extends RecordEvent { diff --git a/lib/Alchemy/Phrasea/Core/Event/RecordEvent/RecordOriginalNameChangedEvent.php b/lib/Alchemy/Phrasea/Core/Event/Record/RecordOriginalNameChangedEvent.php similarity index 84% rename from lib/Alchemy/Phrasea/Core/Event/RecordEvent/RecordOriginalNameChangedEvent.php rename to lib/Alchemy/Phrasea/Core/Event/Record/RecordOriginalNameChangedEvent.php index f4f30dd902..5d2641e40b 100644 --- a/lib/Alchemy/Phrasea/Core/Event/RecordEvent/RecordOriginalNameChangedEvent.php +++ b/lib/Alchemy/Phrasea/Core/Event/Record/RecordOriginalNameChangedEvent.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Alchemy\Phrasea\Core\Event\RecordEvent; +namespace Alchemy\Phrasea\Core\Event\Record; class RecordOriginalNameChangedEvent extends RecordEvent { diff --git a/lib/Alchemy/Phrasea/Core/Event/RecordEvent/RecordStatusChangedEvent.php b/lib/Alchemy/Phrasea/Core/Event/Record/RecordStatusChangedEvent.php similarity index 84% rename from lib/Alchemy/Phrasea/Core/Event/RecordEvent/RecordStatusChangedEvent.php rename to lib/Alchemy/Phrasea/Core/Event/Record/RecordStatusChangedEvent.php index 1df53ffcab..4db7a42924 100644 --- a/lib/Alchemy/Phrasea/Core/Event/RecordEvent/RecordStatusChangedEvent.php +++ b/lib/Alchemy/Phrasea/Core/Event/Record/RecordStatusChangedEvent.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Alchemy\Phrasea\Core\Event\RecordEvent; +namespace Alchemy\Phrasea\Core\Event\Record; class RecordStatusChangedEvent extends RecordEvent { diff --git a/lib/Alchemy/Phrasea/Core/Event/RecordEvent/RecordSubDefinitionCreatedEvent.php b/lib/Alchemy/Phrasea/Core/Event/Record/RecordSubDefinitionCreatedEvent.php similarity index 92% rename from lib/Alchemy/Phrasea/Core/Event/RecordEvent/RecordSubDefinitionCreatedEvent.php rename to lib/Alchemy/Phrasea/Core/Event/Record/RecordSubDefinitionCreatedEvent.php index 738ff295da..77387ffe02 100644 --- a/lib/Alchemy/Phrasea/Core/Event/RecordEvent/RecordSubDefinitionCreatedEvent.php +++ b/lib/Alchemy/Phrasea/Core/Event/Record/RecordSubDefinitionCreatedEvent.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Alchemy\Phrasea\Core\Event\RecordEvent; +namespace Alchemy\Phrasea\Core\Event\Record; class RecordSubDefinitionCreatedEvent extends RecordEvent { diff --git a/lib/Alchemy/Phrasea/Core/Event/RecordEvent/RecordSubDefinitionSubstitutedEvent.php b/lib/Alchemy/Phrasea/Core/Event/Record/RecordSubDefinitionSubstitutedEvent.php similarity index 84% rename from lib/Alchemy/Phrasea/Core/Event/RecordEvent/RecordSubDefinitionSubstitutedEvent.php rename to lib/Alchemy/Phrasea/Core/Event/Record/RecordSubDefinitionSubstitutedEvent.php index 22cc779d21..fcc8915f8b 100644 --- a/lib/Alchemy/Phrasea/Core/Event/RecordEvent/RecordSubDefinitionSubstitutedEvent.php +++ b/lib/Alchemy/Phrasea/Core/Event/Record/RecordSubDefinitionSubstitutedEvent.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Alchemy\Phrasea\Core\Event\RecordEvent; +namespace Alchemy\Phrasea\Core\Event\Record; class RecordSubDefinitionSubstitutedEvent extends RecordEvent { diff --git a/lib/Alchemy/Phrasea/Core/Event/DataboxEvent/DataboxIndexEvent.php b/lib/Alchemy/Phrasea/Core/Event/Record/Structure/FieldDeletedEvent.php similarity index 68% rename from lib/Alchemy/Phrasea/Core/Event/DataboxEvent/DataboxIndexEvent.php rename to lib/Alchemy/Phrasea/Core/Event/Record/Structure/FieldDeletedEvent.php index d8aba82669..03adb571a2 100644 --- a/lib/Alchemy/Phrasea/Core/Event/DataboxEvent/DataboxIndexEvent.php +++ b/lib/Alchemy/Phrasea/Core/Event/Record/Structure/FieldDeletedEvent.php @@ -9,9 +9,8 @@ * file that was distributed with this source code. */ -namespace Alchemy\Phrasea\Core\Event\DataboxEvent; +namespace Alchemy\Phrasea\Core\Event\Record\Structure; -class DataboxIndexEvent extends DataboxEvent +class FieldDeletedEvent extends FieldEvent { - } diff --git a/lib/Alchemy/Phrasea/Core/Event/DataboxEvent/DeleteStructureFieldEvent.php b/lib/Alchemy/Phrasea/Core/Event/Record/Structure/FieldEvent.php similarity index 82% rename from lib/Alchemy/Phrasea/Core/Event/DataboxEvent/DeleteStructureFieldEvent.php rename to lib/Alchemy/Phrasea/Core/Event/Record/Structure/FieldEvent.php index 57f2b24372..d7be391626 100644 --- a/lib/Alchemy/Phrasea/Core/Event/DataboxEvent/DeleteStructureFieldEvent.php +++ b/lib/Alchemy/Phrasea/Core/Event/Record/Structure/FieldEvent.php @@ -9,17 +9,17 @@ * file that was distributed with this source code. */ -namespace Alchemy\Phrasea\Core\Event\DataboxEvent; +namespace Alchemy\Phrasea\Core\Event\Record\Structure; -class DeleteStructureFieldEvent extends DataboxEvent +abstract class FieldEvent extends RecordStructureEvent { private $field; public function __construct(\databox $databox, \databox_field $field) { - $this->field = $field; - parent::__construct($databox); + + $this->field = $field; } /** diff --git a/lib/Alchemy/Phrasea/Core/Event/Record/Structure/FieldUpdatedEvent.php b/lib/Alchemy/Phrasea/Core/Event/Record/Structure/FieldUpdatedEvent.php new file mode 100644 index 0000000000..96ab18e356 --- /dev/null +++ b/lib/Alchemy/Phrasea/Core/Event/Record/Structure/FieldUpdatedEvent.php @@ -0,0 +1,16 @@ +status = $status; - parent::__construct($databox); + + $this->bit = $bit; } - public function getStatus() + public function getBit() { - return $this->status; + return $this->bit; } } diff --git a/lib/Alchemy/Phrasea/Core/Event/Record/Structure/StatusBitUpdatedEvent.php b/lib/Alchemy/Phrasea/Core/Event/Record/Structure/StatusBitUpdatedEvent.php new file mode 100644 index 0000000000..a6755174fe --- /dev/null +++ b/lib/Alchemy/Phrasea/Core/Event/Record/Structure/StatusBitUpdatedEvent.php @@ -0,0 +1,29 @@ +properties = $properties; + } + + public function getProperties() + { + return $this->properties; + } +} diff --git a/lib/Alchemy/Phrasea/Core/PhraseaEvents.php b/lib/Alchemy/Phrasea/Core/PhraseaEvents.php index 7a60d074df..e6d72a258b 100644 --- a/lib/Alchemy/Phrasea/Core/PhraseaEvents.php +++ b/lib/Alchemy/Phrasea/Core/PhraseaEvents.php @@ -42,14 +42,6 @@ final class PhraseaEvents const EXPORT_MAIL_FAILURE = 'export.mail-failure'; const EXPORT_CREATE = 'export.create'; - - - const DATABOX_UPDATE_FIELD = 'databox.update.field'; - const DATABOX_DELETE_FIELD = 'databox.delete.field'; - - const DATABOX_UPDATE_STATUS = 'databox.create.status'; - const DATABOX_DELETE_STATUS = 'databox.delete.status'; - const COLLECTION_CHANGE_NAME = 'collection.name'; const COLLECTION_CREATE = 'collection.create'; diff --git a/lib/Alchemy/Phrasea/Media/SubdefGenerator.php b/lib/Alchemy/Phrasea/Media/SubdefGenerator.php index a1410d0087..e94e8b4c83 100644 --- a/lib/Alchemy/Phrasea/Media/SubdefGenerator.php +++ b/lib/Alchemy/Phrasea/Media/SubdefGenerator.php @@ -12,8 +12,8 @@ namespace Alchemy\Phrasea\Media; use Alchemy\Phrasea\Application; -use Alchemy\Phrasea\Core\Event\RecordEvent\RecordSubDefinitionCreatedEvent; -use Alchemy\Phrasea\Core\Event\RecordEvent\RecordEvents; +use Alchemy\Phrasea\Core\Event\Record\RecordSubDefinitionCreatedEvent; +use Alchemy\Phrasea\Core\Event\Record\RecordEvents; use MediaAlchemyst\Alchemyst; use MediaAlchemyst\Specification\SpecificationInterface; use MediaVorus\MediaVorus; diff --git a/lib/Alchemy/Phrasea/Media/SubdefSubstituer.php b/lib/Alchemy/Phrasea/Media/SubdefSubstituer.php index 4518e3bbda..a9b505f841 100644 --- a/lib/Alchemy/Phrasea/Media/SubdefSubstituer.php +++ b/lib/Alchemy/Phrasea/Media/SubdefSubstituer.php @@ -12,8 +12,8 @@ namespace Alchemy\Phrasea\Media; use Alchemy\Phrasea\Application; -use Alchemy\Phrasea\Core\Event\RecordEvent\RecordMediaSubstitutedEvent; -use Alchemy\Phrasea\Core\Event\RecordEvent\RecordEvents; +use Alchemy\Phrasea\Core\Event\Record\RecordMediaSubstitutedEvent; +use Alchemy\Phrasea\Core\Event\Record\RecordEvents; use MediaAlchemyst\Alchemyst; use MediaAlchemyst\Exception\ExceptionInterface as MediaAlchemystException; use MediaVorus\Media\MediaInterface; diff --git a/lib/Alchemy/Phrasea/Metadata/PhraseanetMetadataSetter.php b/lib/Alchemy/Phrasea/Metadata/PhraseanetMetadataSetter.php index d10d2cf1ae..dcc34a69d2 100644 --- a/lib/Alchemy/Phrasea/Metadata/PhraseanetMetadataSetter.php +++ b/lib/Alchemy/Phrasea/Metadata/PhraseanetMetadataSetter.php @@ -11,8 +11,8 @@ namespace Alchemy\Phrasea\Metadata; -use Alchemy\Phrasea\Core\Event\RecordEvent\RecordEvents; -use Alchemy\Phrasea\Core\Event\RecordEvent\RecordMetadataChangedEvent; +use Alchemy\Phrasea\Core\Event\Record\RecordEvents; +use Alchemy\Phrasea\Core\Event\Record\RecordMetadataChangedEvent; use PHPExiftool\Driver\Metadata\Metadata; use Symfony\Component\EventDispatcher\EventDispatcherInterface; diff --git a/lib/Alchemy/Phrasea/TaskManager/Job/ArchiveJob.php b/lib/Alchemy/Phrasea/TaskManager/Job/ArchiveJob.php index 9db6f7ed86..46a2169c51 100644 --- a/lib/Alchemy/Phrasea/TaskManager/Job/ArchiveJob.php +++ b/lib/Alchemy/Phrasea/TaskManager/Job/ArchiveJob.php @@ -12,8 +12,8 @@ namespace Alchemy\Phrasea\TaskManager\Job; use Alchemy\Phrasea\Application; -use Alchemy\Phrasea\Core\Event\RecordEvent\RecordEvents; -use Alchemy\Phrasea\Core\Event\RecordEvent\RecordCreatedEvent; +use Alchemy\Phrasea\Core\Event\Record\RecordEvents; +use Alchemy\Phrasea\Core\Event\Record\RecordCreatedEvent; use Alchemy\Phrasea\Exception\RuntimeException; use Alchemy\Phrasea\Border\File; use Alchemy\Phrasea\TaskManager\Editor\ArchiveEditor; diff --git a/lib/Alchemy/Phrasea/TaskManager/Job/RecordMoverJob.php b/lib/Alchemy/Phrasea/TaskManager/Job/RecordMoverJob.php index a62a283510..0f6b4087da 100644 --- a/lib/Alchemy/Phrasea/TaskManager/Job/RecordMoverJob.php +++ b/lib/Alchemy/Phrasea/TaskManager/Job/RecordMoverJob.php @@ -12,10 +12,10 @@ 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\Event\Record\RecordCollectionChangedEvent; +use Alchemy\Phrasea\Core\Event\Record\RecordDeletedEvent; +use Alchemy\Phrasea\Core\Event\Record\RecordEvents; +use Alchemy\Phrasea\Core\Event\Record\RecordStatusChangedEvent; use Alchemy\Phrasea\Core\PhraseaEvents; use Alchemy\Phrasea\TaskManager\Editor\RecordMoverEditor; use JMS\Serializer\EventDispatcher\EventDispatcher; diff --git a/lib/classes/caption/field.php b/lib/classes/caption/field.php index 1e9758ad00..0b696b5ad8 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\Event\RecordEvent\RecordEvents; +use Alchemy\Phrasea\Core\Event\Record\RecordMetadataChangedEvent; +use Alchemy\Phrasea\Core\Event\Record\RecordEvents; use Symfony\Component\EventDispatcher\EventDispatcherInterface; class caption_field implements cache_cacheableInterface diff --git a/lib/classes/databox/field.php b/lib/classes/databox/field.php index eab6ea0d6b..b5697381ea 100644 --- a/lib/classes/databox/field.php +++ b/lib/classes/databox/field.php @@ -10,6 +10,10 @@ */ use Alchemy\Phrasea\Application; +use Alchemy\Phrasea\Core\Event\Record\Structure\FieldDeletedEvent; +use Alchemy\Phrasea\Core\Event\Record\Structure\FieldEvent; +use Alchemy\Phrasea\Core\Event\Record\Structure\FieldUpdatedEvent; +use Alchemy\Phrasea\Core\Event\Record\Structure\RecordStructureEvents; use Alchemy\Phrasea\Vocabulary; use Alchemy\Phrasea\Vocabulary\ControlProvider\ControlProviderInterface; use Alchemy\Phrasea\Metadata\Tag\Nosource; @@ -359,6 +363,8 @@ class databox_field implements cache_cacheableInterface $this->delete_data_from_cache(); $this->databox->saveStructure($dom_struct); + $this->dispatchEvent(RecordStructureEvents::FIELD_DELETED, new FieldDeletedEvent($databox, $this)); + return; } @@ -467,9 +473,16 @@ class databox_field implements cache_cacheableInterface $this->delete_data_from_cache(); $this->databox->saveStructure($dom_struct); + $this->dispatchEvent(RecordStructureEvents::FIELD_UPDATED, new FieldUpdatedEvent($databox, $this)); + return $this; } + private function dispatchEvent($eventName, FieldEvent $event = null) + { + $this->app['dispatcher']->dispatch($eventName, $event); + } + /** * Sets a localized label for the field. * diff --git a/lib/classes/databox/status.php b/lib/classes/databox/status.php index 8bc19dee48..575762879d 100644 --- a/lib/classes/databox/status.php +++ b/lib/classes/databox/status.php @@ -257,6 +257,8 @@ class databox_status unset(self::$_status[$databox->get_sbas_id()]->status[$bit]); + $app['dispatcher']->dispatch(RecordStructureEvents::STATUS_BIT_DELETED, new StatusBitDeletedEvent($databox, $bit)); + return true; } } @@ -348,6 +350,9 @@ class databox_status if ( ! isset(self::$_status[$sbas_id]->status[$bit]['img_off'])) { self::$_status[$sbas_id]->status[$bit]['img_off'] = null; } + + $properties = self::$_status[$sbas_id]->status[$bit]; + $app['dispatcher']->dispatch(RecordStructureEvents::STATUS_BIT_UPDATED, new StatusBitUpdatedEvent($databox, $bit, $properties)); } return false; diff --git a/lib/classes/module/console/fieldsMerge.php b/lib/classes/module/console/fieldsMerge.php index a7015ef42e..99ad545665 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\Event\Record\RecordEvents; +use Alchemy\Phrasea\Core\Event\Record\RecordMetadataChangedEvent; class module_console_fieldsMerge extends Command {