Пример #1
0
    /**
    * {@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 extractProvider
  */
 public function testExtract($value, $expected)
 {
     $this->assertEquals($expected, $this->_strategy->extract($value));
 }