You are here

class DelegatingHydrator in Zircon Profile 8.0

Same name in this branch
  1. 8.0 vendor/zendframework/zend-hydrator/src/DelegatingHydrator.php \Zend\Hydrator\DelegatingHydrator
  2. 8.0 vendor/zendframework/zend-stdlib/src/Hydrator/DelegatingHydrator.php \Zend\Stdlib\Hydrator\DelegatingHydrator
Same name and namespace in other branches
  1. 8 vendor/zendframework/zend-hydrator/src/DelegatingHydrator.php \Zend\Hydrator\DelegatingHydrator

Hierarchy

Expanded class hierarchy of DelegatingHydrator

1 file declares its use of DelegatingHydrator
DelegatingHydrator.php in vendor/zendframework/zend-stdlib/src/Hydrator/DelegatingHydrator.php

File

vendor/zendframework/zend-hydrator/src/DelegatingHydrator.php, line 14

Namespace

Zend\Hydrator
View source
class DelegatingHydrator implements HydratorInterface {

  /**
   * @var ServiceLocatorInterface
   */
  protected $hydrators;

  /**
   * Constructor
   *
   * @param ServiceLocatorInterface $hydrators
   */
  public function __construct(ServiceLocatorInterface $hydrators) {
    $this->hydrators = $hydrators;
  }

  /**
   * {@inheritdoc}
   */
  public function hydrate(array $data, $object) {
    return $this
      ->getHydrator($object)
      ->hydrate($data, $object);
  }

  /**
   * {@inheritdoc}
   */
  public function extract($object) {
    return $this
      ->getHydrator($object)
      ->extract($object);
  }

  /**
   * Gets hydrator of an object
   *
   * @param  object $object
   * @return HydratorInterface
   */
  protected function getHydrator($object) {
    return $this->hydrators
      ->get(get_class($object));
  }

}

Members

Namesort descending Modifiers Type Description Overrides
DelegatingHydrator::$hydrators protected property
DelegatingHydrator::extract public function Extract values from an object Overrides ExtractionInterface::extract
DelegatingHydrator::getHydrator protected function Gets hydrator of an object
DelegatingHydrator::hydrate public function Hydrate $object with the provided $data. Overrides HydrationInterface::hydrate
DelegatingHydrator::__construct public function Constructor