/** * {@inheritdoc} */ public function hydrate($value) { if (!$value instanceof Collection && !is_array($value)) { throw new InvalidArgumentException( sprintf('Value to hydrate must be instance of Doctrine\Common\Collections\Collection, instance of \'%s\' given', gettype($value) ) ); } $items = new ArrayCollection(); foreach ($value as $object) { $items->add($this->entityStrategy->hydrate($object)); } return $items; }
/** * @dataProvider hydrateProvider */ public function testHydrate($value, $expected) { $this->assertEquals($expected, $this->_strategy->hydrate($value)); }