| Conditions | 4 |
| Paths | 4 |
| Total Lines | 19 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 24 | public function getFakerMethodFromDoctrineFieldMappings(ReflectionClass $entity): array |
||
| 25 | { |
||
| 26 | $properties = []; |
||
| 27 | $classMetaData = $this->em->getClassMetadata($entity->getName()); |
||
| 28 | $identifierFieldNames = $classMetaData->getIdentifierFieldNames(); |
||
| 29 | |||
| 30 | foreach ($classMetaData->fieldMappings as $property) { |
||
| 31 | // IGNORE FIELD IF IDENTIFIER |
||
| 32 | if (\in_array($property['fieldName'], $identifierFieldNames)) { |
||
| 33 | continue; |
||
| 34 | } |
||
| 35 | |||
| 36 | // CREATE FROM DOCTRINE TYPE IF PROP IS NOT NULLABLE |
||
| 37 | if (!$property['nullable']) { |
||
| 38 | $properties[$property['fieldName']] = $this->createFakerMethodFromDoctrineType($property['type']); |
||
| 39 | } |
||
| 40 | } |
||
| 41 | |||
| 42 | return $properties; |
||
| 43 | } |
||
| 66 |