public function hydrate($value, HydrationContext $context = null)
 {
     if (!is_array($value)) {
         return $value;
     }
     return $this->hydrator->hydrate($value, null);
 }
Esempio n. 2
0
 public function hydrate(array $data, $object)
 {
     if (is_object($this->prototype) && $object === null) {
         $object = clone $this->prototype;
     }
     return $this->hydrator->hydrate($data, $object);
 }
Esempio n. 3
0
 /**
  * {@inheritDoc}
  */
 public function hydrate($value, $property, HydrationContext $context = null)
 {
     if (is_array($value)) {
         $property = $this->namingStrategy->getNameForHydration($property, $context);
         $method = 'get' . $property;
         $object = $context->object->{$method}();
         return $this->hydrator->hydrate($value, $object);
     }
     return $value;
 }
 public function hydrate($value, HydrationContext $context = null)
 {
     if (!is_array($value)) {
         return $value;
     }
     $collection = [];
     foreach ($value as $data) {
         $collection[] = $this->hydrator->hydrate($data, null);
     }
     return $collection;
 }
 /**
  *
  * @dataProvider hydrateProvider
  */
 public function testHydrate(HydratorInterface $hydrator, array $data, $expObjFunc)
 {
     $object = $hydrator->hydrate($data, null);
     $this->assertEquals($expObjFunc(), $object);
 }