private function replaceEntitiesForItsPrimaryKeyValues(array $entities)
{
foreach ($entities as &$entity) {
if ($entity instanceof LeanMapper\Entity) {
$entityTable = $this->mapper->getTable(get_class($entity));
// FIXME: Column name could be specified in the entity instead of mapper provided by 'getEntityField' function.
$idField = $this->mapper->getEntityField($entityTable, $this->mapper->getPrimaryKey($entityTable));
$entity = $entity->{$idField};
}
}
return $entities;
}