mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-15 14:03:27 +00:00
Move RECORD_* events in a new RecordEvents class
This commit is contained in:
@@ -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:
|
||||
|
@@ -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 <info>%d</info> 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 <info>%d</info> has been created", $elementCreated->getId())
|
||||
|
@@ -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())];
|
||||
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
|
@@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -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) {
|
||||
|
||||
|
@@ -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);
|
||||
|
@@ -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', '')) {
|
||||
|
@@ -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']++;
|
||||
}
|
||||
|
26
lib/Alchemy/Phrasea/Core/Event/RecordEvent/RecordEvents.php
Normal file
26
lib/Alchemy/Phrasea/Core/Event/RecordEvent/RecordEvents.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2014 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Alchemy\Phrasea\Core\Event\RecordEvent;
|
||||
|
||||
final class RecordEvents
|
||||
{
|
||||
const CREATED = 'record.created';
|
||||
const DELETED = 'record.deleted';
|
||||
// Change
|
||||
const COLLECTION_CHANGED = 'record.collection_changed';
|
||||
const METADATA_CHANGED = 'record.metadata_changed';
|
||||
const ORIGINAL_NAME_CHANGED = 'record.original_name_changed';
|
||||
const STATUS_CHANGED = 'record.status_changed';
|
||||
// Sub-definitions
|
||||
const SUB_DEFINITION_CREATED = 'record.sub_definition_created';
|
||||
const SUB_DEFINITION_SUBSTITUTED = 'record.sub_definition_substituted';
|
||||
}
|
@@ -46,17 +46,6 @@ final class PhraseaEvents
|
||||
const STORY_DELETED = 'story.deleted';
|
||||
const STORY_METADATA_CHANGED = 'story.metadata_changed';
|
||||
|
||||
// Record lifecycle
|
||||
const RECORD_CREATED = 'record.created';
|
||||
const RECORD_DELETED = 'record.deleted';
|
||||
// Record change
|
||||
const RECORD_COLLECTION_CHANGED = 'record.collection_changed';
|
||||
const RECORD_METADATA_CHANGED = 'record.metadata_changed';
|
||||
const RECORD_ORIGINAL_NAME_CHANGED = 'record.original_name_changed';
|
||||
const RECORD_STATUS_CHANGED = 'record.status_changed';
|
||||
// Record sub-definitions
|
||||
const RECORD_SUB_DEFINITION_CREATED = 'record.sub_definition_created';
|
||||
const RECORD_SUB_DEFINITION_SUBSTITUTED = 'record.sub_definition_substituted';
|
||||
|
||||
const DATABOX_UPDATE_FIELD = 'databox.update.field';
|
||||
const DATABOX_DELETE_FIELD = 'databox.delete.field';
|
||||
|
@@ -13,7 +13,7 @@ namespace Alchemy\Phrasea\Media;
|
||||
|
||||
use Alchemy\Phrasea\Application;
|
||||
use Alchemy\Phrasea\Core\Event\RecordEvent\RecordSubDefinitionCreatedEvent;
|
||||
use Alchemy\Phrasea\Core\PhraseaEvents;
|
||||
use Alchemy\Phrasea\Core\Event\RecordEvent\RecordEvents;
|
||||
use MediaAlchemyst\Alchemyst;
|
||||
use MediaAlchemyst\Specification\SpecificationInterface;
|
||||
use MediaVorus\MediaVorus;
|
||||
@@ -75,7 +75,7 @@ class SubdefGenerator
|
||||
|
||||
$record->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;
|
||||
|
@@ -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));
|
||||
}
|
||||
}
|
||||
|
@@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -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()));
|
||||
}
|
||||
|
@@ -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);
|
||||
|
@@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user