Merge record and structure events inside new namespace

This commit is contained in:
Mathieu Darse
2015-01-27 18:58:09 +01:00
parent bc61536a41
commit e287ba1a42
45 changed files with 172 additions and 177 deletions

View File

@@ -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.
*

View File

@@ -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;