mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-17 15:03:25 +00:00
Merge record and structure events inside new namespace
This commit is contained in:
@@ -10,6 +10,10 @@
|
||||
*/
|
||||
|
||||
use Alchemy\Phrasea\Application;
|
||||
use Alchemy\Phrasea\Core\Event\Record\Structure\FieldDeletedEvent;
|
||||
use Alchemy\Phrasea\Core\Event\Record\Structure\FieldEvent;
|
||||
use Alchemy\Phrasea\Core\Event\Record\Structure\FieldUpdatedEvent;
|
||||
use Alchemy\Phrasea\Core\Event\Record\Structure\RecordStructureEvents;
|
||||
use Alchemy\Phrasea\Vocabulary;
|
||||
use Alchemy\Phrasea\Vocabulary\ControlProvider\ControlProviderInterface;
|
||||
use Alchemy\Phrasea\Metadata\Tag\Nosource;
|
||||
@@ -359,6 +363,8 @@ class databox_field implements cache_cacheableInterface
|
||||
$this->delete_data_from_cache();
|
||||
$this->databox->saveStructure($dom_struct);
|
||||
|
||||
$this->dispatchEvent(RecordStructureEvents::FIELD_DELETED, new FieldDeletedEvent($databox, $this));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -467,9 +473,16 @@ class databox_field implements cache_cacheableInterface
|
||||
$this->delete_data_from_cache();
|
||||
$this->databox->saveStructure($dom_struct);
|
||||
|
||||
$this->dispatchEvent(RecordStructureEvents::FIELD_UPDATED, new FieldUpdatedEvent($databox, $this));
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
private function dispatchEvent($eventName, FieldEvent $event = null)
|
||||
{
|
||||
$this->app['dispatcher']->dispatch($eventName, $event);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a localized label for the field.
|
||||
*
|
||||
|
@@ -257,6 +257,8 @@ class databox_status
|
||||
|
||||
unset(self::$_status[$databox->get_sbas_id()]->status[$bit]);
|
||||
|
||||
$app['dispatcher']->dispatch(RecordStructureEvents::STATUS_BIT_DELETED, new StatusBitDeletedEvent($databox, $bit));
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -348,6 +350,9 @@ class databox_status
|
||||
if ( ! isset(self::$_status[$sbas_id]->status[$bit]['img_off'])) {
|
||||
self::$_status[$sbas_id]->status[$bit]['img_off'] = null;
|
||||
}
|
||||
|
||||
$properties = self::$_status[$sbas_id]->status[$bit];
|
||||
$app['dispatcher']->dispatch(RecordStructureEvents::STATUS_BIT_UPDATED, new StatusBitUpdatedEvent($databox, $bit, $properties));
|
||||
}
|
||||
|
||||
return false;
|
||||
|
Reference in New Issue
Block a user