class AggregateHydrator in Zircon Profile 8.0
Same name in this branch
- 8.0 vendor/zendframework/zend-hydrator/src/Aggregate/AggregateHydrator.php \Zend\Hydrator\Aggregate\AggregateHydrator
- 8.0 vendor/zendframework/zend-stdlib/src/Hydrator/Aggregate/AggregateHydrator.php \Zend\Stdlib\Hydrator\Aggregate\AggregateHydrator
Same name and namespace in other branches
- 8 vendor/zendframework/zend-hydrator/src/Aggregate/AggregateHydrator.php \Zend\Hydrator\Aggregate\AggregateHydrator
Aggregate hydrator that composes multiple hydrators via events
Hierarchy
- class \Zend\Hydrator\Aggregate\AggregateHydrator implements \Zend\EventManager\EventManagerAwareInterface, HydratorInterface
Expanded class hierarchy of AggregateHydrator
1 file declares its use of AggregateHydrator
- AggregateHydrator.php in vendor/
zendframework/ zend-stdlib/ src/ Hydrator/ Aggregate/ AggregateHydrator.php
File
- vendor/
zendframework/ zend-hydrator/ src/ Aggregate/ AggregateHydrator.php, line 20
Namespace
Zend\Hydrator\AggregateView source
class AggregateHydrator implements HydratorInterface, EventManagerAwareInterface {
const DEFAULT_PRIORITY = 1;
/**
* @var EventManagerInterface|null
*/
protected $eventManager;
/**
* Attaches the provided hydrator to the list of hydrators to be used while hydrating/extracting data
*
* @param HydratorInterface $hydrator
* @param int $priority
*/
public function add(HydratorInterface $hydrator, $priority = self::DEFAULT_PRIORITY) {
$this
->getEventManager()
->attachAggregate(new HydratorListener($hydrator), $priority);
}
/**
* {@inheritDoc}
*/
public function extract($object) {
$event = new ExtractEvent($this, $object);
$this
->getEventManager()
->trigger($event);
return $event
->getExtractedData();
}
/**
* {@inheritDoc}
*/
public function hydrate(array $data, $object) {
$event = new HydrateEvent($this, $object, $data);
$this
->getEventManager()
->trigger($event);
return $event
->getHydratedObject();
}
/**
* {@inheritDoc}
*/
public function setEventManager(EventManagerInterface $eventManager) {
$eventManager
->setIdentifiers([
__CLASS__,
get_class($this),
]);
$this->eventManager = $eventManager;
}
/**
* {@inheritDoc}
*/
public function getEventManager() {
if (null === $this->eventManager) {
$this
->setEventManager(new EventManager());
}
return $this->eventManager;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
AggregateHydrator:: |
protected | property | ||
AggregateHydrator:: |
public | function | Attaches the provided hydrator to the list of hydrators to be used while hydrating/extracting data | |
AggregateHydrator:: |
constant | |||
AggregateHydrator:: |
public | function |
Extract values from an object Overrides ExtractionInterface:: |
|
AggregateHydrator:: |
public | function | ||
AggregateHydrator:: |
public | function |
Hydrate $object with the provided $data. Overrides HydrationInterface:: |
|
AggregateHydrator:: |
public | function |