| @@ 73-89 (lines=17) @@ | ||
| 70 | * |
|
| 71 | * @return array List of identifier field names |
|
| 72 | */ |
|
| 73 | public function getIdFields($objectType = '') |
|
| 74 | { |
|
| 75 | if (empty($objectType)) { |
|
| 76 | throw new InvalidArgumentException('Invalid object type received.'); |
|
| 77 | } |
|
| 78 | $entityClass = 'ZikulaRoutesModule:' . ucfirst($objectType) . 'Entity'; |
|
| 79 | ||
| 80 | $meta = $this->entityFactory->getObjectManager()->getClassMetadata($entityClass); |
|
| 81 | ||
| 82 | if ($this->hasCompositeKeys($objectType)) { |
|
| 83 | $idFields = $meta->getIdentifierFieldNames(); |
|
| 84 | } else { |
|
| 85 | $idFields = [$meta->getSingleIdentifierFieldName()]; |
|
| 86 | } |
|
| 87 | ||
| 88 | return $idFields; |
|
| 89 | } |
|
| 90 | ||
| 91 | /** |
|
| 92 | * Checks whether a certain entity type uses composite keys or not. |
|
| @@ 53-69 (lines=17) @@ | ||
| 50 | * |
|
| 51 | * @return array List of identifier field names |
|
| 52 | */ |
|
| 53 | public function getIdFields($objectType = '') |
|
| 54 | { |
|
| 55 | if (empty($objectType)) { |
|
| 56 | throw new InvalidArgumentException($this->translator->__('Invalid object type received.')); |
|
| 57 | } |
|
| 58 | $entityClass = 'ZikulaRoutesModule:' . ucfirst($objectType) . 'Entity'; |
|
| 59 | ||
| 60 | $meta = $this->entityFactory->getObjectManager()->getClassMetadata($entityClass); |
|
| 61 | ||
| 62 | if ($this->hasCompositeKeys($objectType)) { |
|
| 63 | $idFields = $meta->getIdentifierFieldNames(); |
|
| 64 | } else { |
|
| 65 | $idFields = [$meta->getSingleIdentifierFieldName()]; |
|
| 66 | } |
|
| 67 | ||
| 68 | return $idFields; |
|
| 69 | } |
|
| 70 | ||
| 71 | /** |
|
| 72 | * Checks whether a certain entity type uses composite keys or not. |
|