Nextras\Orm\Mapper\Memory\RelationshipMapperOneHasMany::getIterator PHP Метод

getIterator() публичный Метод

public getIterator ( Nextras\Orm\Entity\IEntity $parent, Nextras\Orm\Collection\ICollection $collection )
$parent Nextras\Orm\Entity\IEntity
$collection Nextras\Orm\Collection\ICollection
    public function getIterator(IEntity $parent, ICollection $collection)
    {
        $data = $collection->findBy(["this->{$this->joinStorageKey}->id" => $parent->getValue('id')])->fetchAll();
        return new EntityIterator($data);
    }

Usage Example

 public function getIterator(IEntity $parent, ICollection $collection)
 {
     return [parent::getIterator($parent, $collection)->current()];
 }