You are here

public function Reflection::hydrate in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/zendframework/zend-hydrator/src/Reflection.php \Zend\Hydrator\Reflection::hydrate()

Hydrate $object with the provided $data.

Parameters

array $data:

object $object:

Return value

object

Overrides HydrationInterface::hydrate

File

vendor/zendframework/zend-hydrator/src/Reflection.php, line 52

Class

Reflection

Namespace

Zend\Hydrator

Code

public function hydrate(array $data, $object) {
  $reflProperties = self::getReflProperties($object);
  foreach ($data as $key => $value) {
    $name = $this
      ->hydrateName($key, $data);
    if (isset($reflProperties[$name])) {
      $reflProperties[$name]
        ->setValue($object, $this
        ->hydrateValue($name, $value, $data));
    }
  }
  return $object;
}