diff --git a/lib/Alchemy/Phrasea/Command/RecordAdd.php b/lib/Alchemy/Phrasea/Command/RecordAdd.php
index 80e9103c18..ddcdc4ba2b 100644
--- a/lib/Alchemy/Phrasea/Command/RecordAdd.php
+++ b/lib/Alchemy/Phrasea/Command/RecordAdd.php
@@ -13,7 +13,7 @@ namespace Alchemy\Phrasea\Command;
use Alchemy\Phrasea\Border\File;
use Alchemy\Phrasea\Border\Manager;
-use Alchemy\Phrasea\Core\Event\RecordEvent\CreateRecordEvent;
+use Alchemy\Phrasea\Core\Event\RecordEvent\RecordCreatedEvent;
use Alchemy\Phrasea\Core\PhraseaEvents;
use Alchemy\Phrasea\Model\Entities\LazaretFile;
use Alchemy\Phrasea\Model\Entities\LazaretSession;
@@ -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_CREATE, new CreateRecordEvent($elementCreated));
+ $this->container['dispatcher']->dispatch(PhraseaEvents::RECORD_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 ab892e58a3..15f52477d9 100644
--- a/lib/Alchemy/Phrasea/Controller/Api/V1.php
+++ b/lib/Alchemy/Phrasea/Controller/Api/V1.php
@@ -13,7 +13,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\CreateRecordEvent;
+use Alchemy\Phrasea\Core\Event\RecordEvent\RecordCreatedEvent;
use Silex\ControllerProviderInterface;
use Alchemy\Phrasea\Cache\Cache as CacheInterface;
use Alchemy\Phrasea\Core\PhraseaEvents;
@@ -562,7 +562,7 @@ class V1 implements ControllerProviderInterface
$ret['entity'] = '0';
$ret['url'] = '/records/' . $output->get_sbas_id() . '/' . $output->get_record_id() . '/';
- $app['dispatcher']->dispatch(PhraseaEvents::RECORD_CREATE, new CreateRecordEvent($output));
+ $app['dispatcher']->dispatch(PhraseaEvents::RECORD_CREATED, new RecordCreatedEvent($output));
}
if ($output instanceof LazaretFile) {
$ret['entity'] = '1';
diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Lazaret.php b/lib/Alchemy/Phrasea/Controller/Prod/Lazaret.php
index dd547b21a5..115e77bf03 100644
--- a/lib/Alchemy/Phrasea/Controller/Prod/Lazaret.php
+++ b/lib/Alchemy/Phrasea/Controller/Prod/Lazaret.php
@@ -13,7 +13,7 @@ namespace Alchemy\Phrasea\Controller\Prod;
use Alchemy\Phrasea\Core\Event\RecordEvent\ChangeMetadataEvent;
use Alchemy\Phrasea\Core\Event\RecordEvent\ChangeStatusEvent;
-use Alchemy\Phrasea\Core\Event\RecordEvent\CreateRecordEvent;
+use Alchemy\Phrasea\Core\Event\RecordEvent\RecordCreatedEvent;
use Alchemy\Phrasea\Core\PhraseaEvents;
use Alchemy\Phrasea\Model\Entities\LazaretFile;
use Alchemy\Phrasea\Border;
@@ -199,7 +199,7 @@ class Lazaret implements ControllerProviderInterface
$lazaretFile->getSession(), $borderFile, $callBack, Border\Manager::FORCE_RECORD
);
- $app['dispatcher']->dispatch(PhraseaEvents::RECORD_CREATE, new CreateRecordEvent($record));
+ $app['dispatcher']->dispatch(PhraseaEvents::RECORD_CREATED, new RecordCreatedEvent($record));
if ($keepAttributes) {
//add attribute
diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Records.php b/lib/Alchemy/Phrasea/Controller/Prod/Records.php
index 9cdbb1fd17..da6fcafadd 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\DeleteStoryEvent;
+use Alchemy\Phrasea\Core\Event\RecordEvent\RecordDeletedEvent;
use Alchemy\Phrasea\Core\PhraseaEvents;
use Alchemy\Phrasea\SearchEngine\SearchEngineOptions;
use Silex\Application;
@@ -180,7 +181,7 @@ class Records implements ControllerProviderInterface
if ($record->isStory()) {
$app['dispatcher']->dispatch(PhraseaEvents::STORY_DELETE, new DeleteStoryEvent($record));
} else {
- $app['dispatcher']->dispatch(PhraseaEvents::RECORD_DELETE, new DeleteRecordEvent($record));
+ $app['dispatcher']->dispatch(PhraseaEvents::RECORD_DELETED, new RecordDeletedEvent($record));
}
} catch (\Exception $e) {
diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Upload.php b/lib/Alchemy/Phrasea/Controller/Prod/Upload.php
index e112c68bb8..ea61bb3d79 100644
--- a/lib/Alchemy/Phrasea/Controller/Prod/Upload.php
+++ b/lib/Alchemy/Phrasea/Controller/Prod/Upload.php
@@ -14,7 +14,7 @@ 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\CreateRecordEvent;
+use Alchemy\Phrasea\Core\Event\RecordEvent\RecordCreatedEvent;
use Alchemy\Phrasea\Core\PhraseaEvents;
use DataURI\Parser;
use DataURI\Exception\Exception as DataUriException;
@@ -209,7 +209,7 @@ class Upload implements ControllerProviderInterface
$element = 'record';
$message = $app->trans('The record was successfully created');
- $app['dispatcher']->dispatch(PhraseaEvents::RECORD_CREATE, new CreateRecordEvent($elementCreated));
+ $app['dispatcher']->dispatch(PhraseaEvents::RECORD_CREATED, new RecordCreatedEvent($elementCreated));
// try to create thumbnail from data URI
if ('' !== $b64Image = $request->request->get('b64_image', '')) {
diff --git a/lib/Alchemy/Phrasea/Core/Event/RecordEvent/CreateRecordEvent.php b/lib/Alchemy/Phrasea/Core/Event/RecordEvent/RecordCreatedEvent.php
similarity index 63%
rename from lib/Alchemy/Phrasea/Core/Event/RecordEvent/CreateRecordEvent.php
rename to lib/Alchemy/Phrasea/Core/Event/RecordEvent/RecordCreatedEvent.php
index 5612f03f46..06a6486710 100644
--- a/lib/Alchemy/Phrasea/Core/Event/RecordEvent/CreateRecordEvent.php
+++ b/lib/Alchemy/Phrasea/Core/Event/RecordEvent/RecordCreatedEvent.php
@@ -11,10 +11,5 @@
namespace Alchemy\Phrasea\Core\Event\RecordEvent;
-use Alchemy\Phrasea\Model\Entities\Basket;
-use Symfony\Component\EventDispatcher\Event as SfEvent;
-
-class CreateRecordEvent extends RecordEvent
-{
-
-}
+class RecordCreatedEvent extends RecordEvent
+{}
diff --git a/lib/Alchemy/Phrasea/Core/Event/RecordEvent/DeleteRecordEvent.php b/lib/Alchemy/Phrasea/Core/Event/RecordEvent/RecordDeletedEvent.php
similarity index 64%
rename from lib/Alchemy/Phrasea/Core/Event/RecordEvent/DeleteRecordEvent.php
rename to lib/Alchemy/Phrasea/Core/Event/RecordEvent/RecordDeletedEvent.php
index 36c1e4e4dd..c49b8c9fe4 100644
--- a/lib/Alchemy/Phrasea/Core/Event/RecordEvent/DeleteRecordEvent.php
+++ b/lib/Alchemy/Phrasea/Core/Event/RecordEvent/RecordDeletedEvent.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 DeleteRecordEvent extends RecordEvent
+class RecordDeletedEvent extends RecordEvent
{
}
diff --git a/lib/Alchemy/Phrasea/Core/Event/RecordEvent/RecordEvent.php b/lib/Alchemy/Phrasea/Core/Event/RecordEvent/RecordEvent.php
index e63b3ff942..0f0558b680 100644
--- a/lib/Alchemy/Phrasea/Core/Event/RecordEvent/RecordEvent.php
+++ b/lib/Alchemy/Phrasea/Core/Event/RecordEvent/RecordEvent.php
@@ -11,17 +11,18 @@
namespace Alchemy\Phrasea\Core\Event\RecordEvent;
-use Symfony\Component\EventDispatcher\Event as SfEvent;
+use Alchemy\Phrasea\Model\RecordInterface;
+use Symfony\Component\EventDispatcher\Event;
-class RecordEvent extends SfEvent
+abstract class RecordEvent extends Event
{
- public function __construct(\record_adapter $record)
+ public function __construct(RecordInterface $record)
{
$this->record = $record;
}
/**
- * @return \record_adapter
+ * @return RecordInterface
*/
public function getRecord()
{
diff --git a/lib/Alchemy/Phrasea/Core/PhraseaEvents.php b/lib/Alchemy/Phrasea/Core/PhraseaEvents.php
index 5aed176147..9525f940ef 100644
--- a/lib/Alchemy/Phrasea/Core/PhraseaEvents.php
+++ b/lib/Alchemy/Phrasea/Core/PhraseaEvents.php
@@ -42,8 +42,8 @@ final class PhraseaEvents
const EXPORT_MAIL_FAILURE = 'export.mail-failure';
const EXPORT_CREATE = 'export.create';
- const RECORD_CREATE = 'record.create';
- const RECORD_DELETE = 'record.delete';
+ const RECORD_CREATED = 'record.created';
+ const RECORD_DELETED = 'record.deleted';
const STORY_CREATE = 'story.create';
const STORY_DELETE = 'story.delete';
const RECORD_CHANGE_COLLECTION = 'record.collection';
diff --git a/lib/Alchemy/Phrasea/TaskManager/Job/RecordMoverJob.php b/lib/Alchemy/Phrasea/TaskManager/Job/RecordMoverJob.php
index ad504907cf..179f75d9f4 100644
--- a/lib/Alchemy/Phrasea/TaskManager/Job/RecordMoverJob.php
+++ b/lib/Alchemy/Phrasea/TaskManager/Job/RecordMoverJob.php
@@ -14,7 +14,7 @@ namespace Alchemy\Phrasea\TaskManager\Job;
use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Core\Event\RecordEvent\ChangeCollectionEvent;
use Alchemy\Phrasea\Core\Event\RecordEvent\ChangeStatusEvent;
-use Alchemy\Phrasea\Core\Event\RecordEvent\DeleteRecordEvent;
+use Alchemy\Phrasea\Core\Event\RecordEvent\RecordDeletedEvent;
use Alchemy\Phrasea\Core\PhraseaEvents;
use Alchemy\Phrasea\TaskManager\Editor\RecordMoverEditor;
use JMS\Serializer\EventDispatcher\EventDispatcher;
@@ -114,7 +114,7 @@ class RecordMoverJob extends AbstractJob
foreach ($rec->get_children() as $child) {
$child->delete();
- $app['dispatcher']->dispatch(PhraseaEvents::RECORD_DELETE, new DeleteRecordEvent($child));
+ $app['dispatcher']->dispatch(PhraseaEvents::RECORD_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 +122,7 @@ class RecordMoverJob extends AbstractJob
}
}
$rec->delete();
- $app['dispatcher']->dispatch(PhraseaEvents::RECORD_DELETE, new DeleteRecordEvent($rec));
+ $app['dispatcher']->dispatch(PhraseaEvents::RECORD_DELETED, new RecordDeletedEvent($rec));
if ($logsql) {
$this->log('debug', sprintf("on sbas %s delete rid %s \n", $row['sbas_id'], $rec->get_record_id()));
}