mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-17 15:03:25 +00:00
Story record emits proper record events
This commit is contained in:
@@ -14,8 +14,6 @@ namespace Alchemy\Phrasea\Controller\Prod;
|
|||||||
use Alchemy\Phrasea\Controller\RecordsRequest;
|
use Alchemy\Phrasea\Controller\RecordsRequest;
|
||||||
use Alchemy\Phrasea\Core\Event\RecordEvent\RecordDeletedEvent;
|
use Alchemy\Phrasea\Core\Event\RecordEvent\RecordDeletedEvent;
|
||||||
use Alchemy\Phrasea\Core\Event\RecordEvent\RecordEvents;
|
use Alchemy\Phrasea\Core\Event\RecordEvent\RecordEvents;
|
||||||
use Alchemy\Phrasea\Core\Event\RecordEvent\StoryDeletedEvent;
|
|
||||||
use Alchemy\Phrasea\Core\PhraseaEvents;
|
|
||||||
use Alchemy\Phrasea\SearchEngine\SearchEngineOptions;
|
use Alchemy\Phrasea\SearchEngine\SearchEngineOptions;
|
||||||
use Silex\Application;
|
use Silex\Application;
|
||||||
use Silex\ControllerProviderInterface;
|
use Silex\ControllerProviderInterface;
|
||||||
@@ -179,11 +177,7 @@ class Records implements ControllerProviderInterface
|
|||||||
$deleted[] = $record->get_serialize_key();
|
$deleted[] = $record->get_serialize_key();
|
||||||
$record->delete();
|
$record->delete();
|
||||||
|
|
||||||
if ($record->isStory()) {
|
$app['dispatcher']->dispatch(RecordEvents::DELETED, new RecordDeletedEvent($record));
|
||||||
$app['dispatcher']->dispatch(PhraseaEvents::STORY_DELETED, new StoryDeletedEvent($record));
|
|
||||||
} else {
|
|
||||||
$app['dispatcher']->dispatch(RecordEvents::DELETED, new RecordDeletedEvent($record));
|
|
||||||
}
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -13,8 +13,8 @@ namespace Alchemy\Phrasea\Controller\Prod;
|
|||||||
|
|
||||||
use Alchemy\Phrasea\Controller\Exception as ControllerException;
|
use Alchemy\Phrasea\Controller\Exception as ControllerException;
|
||||||
use Alchemy\Phrasea\Controller\RecordsRequest;
|
use Alchemy\Phrasea\Controller\RecordsRequest;
|
||||||
use Alchemy\Phrasea\Core\Event\RecordEvent\StoryMetadataChangedEvent;
|
use Alchemy\Phrasea\Core\Event\RecordEvent\RecordEvents;
|
||||||
use Alchemy\Phrasea\Core\PhraseaEvents;
|
use Alchemy\Phrasea\Core\Event\RecordEvent\RecordMetadataChangedEvent;
|
||||||
use Alchemy\Phrasea\Model\Entities\StoryWZ;
|
use Alchemy\Phrasea\Model\Entities\StoryWZ;
|
||||||
use Silex\Application;
|
use Silex\Application;
|
||||||
use Silex\ControllerProviderInterface;
|
use Silex\ControllerProviderInterface;
|
||||||
@@ -76,7 +76,7 @@ class Story implements ControllerProviderInterface
|
|||||||
|
|
||||||
$Story->set_metadatas($metadatas)->rebuild_subdefs();
|
$Story->set_metadatas($metadatas)->rebuild_subdefs();
|
||||||
|
|
||||||
$app['dispatcher']->dispatch(PhraseaEvents::STORY_METADATA_CHANGED, new StoryMetadataChangedEvent($Story));
|
$app['dispatcher']->dispatch(RecordEvents::METADATA_CHANGED, new RecordMetadataChangedEvent($Story));
|
||||||
|
|
||||||
$StoryWZ = new StoryWZ();
|
$StoryWZ = new StoryWZ();
|
||||||
$StoryWZ->setUser($app['authentication']->getUser());
|
$StoryWZ->setUser($app['authentication']->getUser());
|
||||||
|
@@ -1,16 +0,0 @@
|
|||||||
<?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;
|
|
||||||
|
|
||||||
class StoryCreatedEvent extends RecordEvent
|
|
||||||
{
|
|
||||||
}
|
|
@@ -1,16 +0,0 @@
|
|||||||
<?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;
|
|
||||||
|
|
||||||
class StoryDeletedEvent extends RecordEvent
|
|
||||||
{
|
|
||||||
}
|
|
@@ -1,16 +0,0 @@
|
|||||||
<?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;
|
|
||||||
|
|
||||||
class StoryMetadataChangedEvent extends RecordEvent
|
|
||||||
{
|
|
||||||
}
|
|
@@ -42,9 +42,6 @@ final class PhraseaEvents
|
|||||||
const EXPORT_MAIL_FAILURE = 'export.mail-failure';
|
const EXPORT_MAIL_FAILURE = 'export.mail-failure';
|
||||||
const EXPORT_CREATE = 'export.create';
|
const EXPORT_CREATE = 'export.create';
|
||||||
|
|
||||||
const STORY_CREATED = 'story.created';
|
|
||||||
const STORY_DELETED = 'story.deleted';
|
|
||||||
const STORY_METADATA_CHANGED = 'story.metadata_changed';
|
|
||||||
|
|
||||||
|
|
||||||
const DATABOX_UPDATE_FIELD = 'databox.update.field';
|
const DATABOX_UPDATE_FIELD = 'databox.update.field';
|
||||||
|
@@ -12,8 +12,8 @@
|
|||||||
namespace Alchemy\Phrasea\TaskManager\Job;
|
namespace Alchemy\Phrasea\TaskManager\Job;
|
||||||
|
|
||||||
use Alchemy\Phrasea\Application;
|
use Alchemy\Phrasea\Application;
|
||||||
use Alchemy\Phrasea\Core\Event\RecordEvent\StoryCreatedEvent;
|
use Alchemy\Phrasea\Core\Event\RecordEvent\RecordEvents;
|
||||||
use Alchemy\Phrasea\Core\PhraseaEvents;
|
use Alchemy\Phrasea\Core\Event\RecordEvent\RecordCreatedEvent;
|
||||||
use Alchemy\Phrasea\Exception\RuntimeException;
|
use Alchemy\Phrasea\Exception\RuntimeException;
|
||||||
use Alchemy\Phrasea\Border\File;
|
use Alchemy\Phrasea\Border\File;
|
||||||
use Alchemy\Phrasea\TaskManager\Editor\ArchiveEditor;
|
use Alchemy\Phrasea\TaskManager\Editor\ArchiveEditor;
|
||||||
@@ -1018,7 +1018,7 @@ class ArchiveJob extends AbstractJob
|
|||||||
$story->set_binary_status(\databox_status::operation_or($app, $stat0, $stat1));
|
$story->set_binary_status(\databox_status::operation_or($app, $stat0, $stat1));
|
||||||
$story->rebuild_subdefs();
|
$story->rebuild_subdefs();
|
||||||
|
|
||||||
$app['dispatcher']->dispatch(PhraseaEvents::STORY_CREATED, new StoryCreatedEvent($story));
|
$app['dispatcher']->dispatch(RecordEvents::CREATED, new RecordCreatedEvent($story));
|
||||||
|
|
||||||
unset($media);
|
unset($media);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user