mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 15:33:15 +00:00
PHRAS-1158_STAMP-CHANGE-COLL
change : stamp reset moved to event subscriber
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
|
||||
namespace Alchemy\Phrasea\Core\Event\Subscriber;
|
||||
|
||||
use Alchemy\Phrasea\Core\Event\Record\CollectionChangedEvent;
|
||||
use Alchemy\Phrasea\Core\Event\Record\RecordEvent;
|
||||
use Alchemy\Phrasea\Core\Event\Record\RecordEvents;
|
||||
use Alchemy\Phrasea\Core\Event\RecordEdit;
|
||||
@@ -27,6 +28,7 @@ class RecordEditSubscriber implements EventSubscriberInterface
|
||||
PhraseaEvents::RECORD_EDIT => 'onEdit',
|
||||
PhraseaEvents::RECORD_UPLOAD => 'onEdit',
|
||||
RecordEvents::ROTATE => 'onRecordChange',
|
||||
RecordEvents::COLLECTION_CHANGED => 'onCollectionChanged',
|
||||
);
|
||||
}
|
||||
|
||||
@@ -40,6 +42,12 @@ class RecordEditSubscriber implements EventSubscriberInterface
|
||||
$this->appboxLocator = $appboxLocator;
|
||||
}
|
||||
|
||||
public function onCollectionChanged(CollectionChangedEvent $event)
|
||||
{
|
||||
$recordAdapter = $this->convertToRecordAdapter($event->getRecord());
|
||||
$recordAdapter->clearStampCache();
|
||||
}
|
||||
|
||||
public function onEdit(RecordEdit $event)
|
||||
{
|
||||
$recordAdapter = $this->convertToRecordAdapter($event->getRecord());
|
||||
@@ -57,6 +65,8 @@ class RecordEditSubscriber implements EventSubscriberInterface
|
||||
if ($editDateField instanceof \databox_field) {
|
||||
$this->updateRecord($recordAdapter, $editDateField);
|
||||
}
|
||||
|
||||
$recordAdapter->clearStampCache();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -477,7 +477,7 @@ class record_adapter implements RecordInterface, cache_cacheableInterface
|
||||
|
||||
// remove stamp BEFORE changing collection since it uses the collection id :(
|
||||
// todo : change clearStampCache() to be agnostic of collection
|
||||
$this->clearStampCache();
|
||||
// $this->clearStampCache();
|
||||
|
||||
$sql = "UPDATE record SET moddate = NOW(), coll_id = :coll_id WHERE record_id =:record_id";
|
||||
|
||||
@@ -997,7 +997,7 @@ class record_adapter implements RecordInterface, cache_cacheableInterface
|
||||
$this->set_metadata($param, $this->getDatabox());
|
||||
}
|
||||
|
||||
$this->clearStampCache();
|
||||
// $this->clearStampCache();
|
||||
|
||||
$xml = new DOMDocument();
|
||||
$xml->loadXML($this->app['serializer.caption']->serialize($this->get_caption(), CaptionSerializer::SERIALIZE_XML, true));
|
||||
|
Reference in New Issue
Block a user