return $mapping;
} /**
* @param array<string, list<Entity>> $mapping
*
* @return array<string, list<Entity>>
*/
private function map(Entity
$entity, array
$mapping): array
{ $mapping[$entity->
getInternalEntityName()][] =
$entity;
$vars =
$entity->
getVars();
foreach ($vars as $value) { if ($value instanceof Entity
) { $mapping =
$this->
map($value,
$mapping);
continue;
} if ($value instanceof Collection
) { $value =
$value->
getElements();
}