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;
}