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