if (\
is_array($value)) { $field =
$definition->
getField($key);
if (!
$field instanceof AssociationField
) { continue;
} $nested =
[];
if ($field instanceof ManyToManyAssociationField ||
$field instanceof OneToManyAssociationField
) { $ref =
$field instanceof ManyToManyAssociationField ?
$field->
getToManyReferenceDefinition()->
getEntityName() :
$field->
getReferenceDefinition()->
getEntityName();
$nested =
$this->
collect($ref,
$value);
} elseif ($field instanceof ManyToOneAssociationField ||
$field instanceof OneToOneAssociationField
) { $tmp =
[$value];
$nested =
$this->
collect($field->
getReferenceDefinition()->
getEntityName(),
$tmp);
$value = \
array_shift($tmp);
} $map =
$this->
merge($map,
$nested);
} } }