/** * @param $entity * @param \Doctrine\ORM\Mapping\ClassMetadataInfo $classMetadataInfo * * @return string */ private function getIdentifierForEntity($entity, ClassMetadataInfo $classMetadataInfo) { $entityName = $classMetadataInfo->getName(); $fixtureEntityIdentifier = strtolower(str_replace('\\', '_', $entityName)); $identifiers = $classMetadataInfo->getIdentifier(); foreach ($identifiers as $identifier) { $fixtureEntityIdentifier .= '_' . $classMetadataInfo->getFieldValue($entity, $identifier); } return $fixtureEntityIdentifier; }