mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-23 18:03:17 +00:00
port PHRAS-1730 to 4.1: dispatch record.edit event
This commit is contained in:
@@ -14,6 +14,8 @@ use Alchemy\Phrasea\Application\Helper\EntityManagerAware;
|
||||
use Alchemy\Phrasea\Application\Helper\SearchEngineAware;
|
||||
use Alchemy\Phrasea\Controller\Controller;
|
||||
use Alchemy\Phrasea\Controller\RecordsRequest;
|
||||
use Alchemy\Phrasea\Core\Event\RecordEdit;
|
||||
use Alchemy\Phrasea\Core\PhraseaEvents;
|
||||
use Alchemy\Phrasea\Model\Entities\BasketElement;
|
||||
use Alchemy\Phrasea\Model\Repositories\BasketElementRepository;
|
||||
use Alchemy\Phrasea\Model\Repositories\StoryWZRepository;
|
||||
@@ -194,6 +196,8 @@ class RecordController extends Controller
|
||||
$trashCollectionsBySbasId = [];
|
||||
|
||||
$manager = $this->getEntityManager();
|
||||
|
||||
/** @var \record_adapter $record */
|
||||
foreach ($records as $record) {
|
||||
try {
|
||||
$basketElements = $basketElementsRepository->findElementsByRecord($record);
|
||||
@@ -209,6 +213,10 @@ class RecordController extends Controller
|
||||
$manager->remove($attachedStory);
|
||||
}
|
||||
|
||||
foreach($record->get_grouping_parents() as $story) {
|
||||
$this->getEventDispatcher()->dispatch(PhraseaEvents::RECORD_EDIT, new RecordEdit($story));
|
||||
}
|
||||
|
||||
$sbasId = $record->getDatabox()->get_sbas_id();
|
||||
if(!array_key_exists($sbasId, $trashCollectionsBySbasId)) {
|
||||
$trashCollectionsBySbasId[$sbasId] = $record->getDatabox()->getTrashCollection();
|
||||
@@ -332,4 +340,12 @@ class RecordController extends Controller
|
||||
|
||||
return $this->app->json($renewed);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return EventDispatcherInterface
|
||||
*/
|
||||
private function getEventDispatcher()
|
||||
{
|
||||
return $this->app['dispatcher'];
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user