Nextras\Orm\Mapper\Dbal\RelationshipMapperManyHasMany::buildList PHP Method

buildList() protected method

protected buildList ( Nextras\Orm\Entity\IEntity $parent, array $entries )
$parent Nextras\Orm\Entity\IEntity
$entries array
    protected function buildList(IEntity $parent, array $entries)
    {
        if (!$this->metadata->relationship->isMain) {
            throw new LogicException('ManyHasMany relationship has to be persisted in the primary mapper.');
        }
        $list = [];
        $primaryId = $parent->getValue('id');
        foreach ($entries as $id) {
            $list[] = [$this->primaryKeyFrom => $primaryId, $this->primaryKeyTo => $id];
        }
        return $list;
    }