| @@ 82-96 (lines=15) @@ | ||
| 79 | * @return array |
|
| 80 | * @throws MappingException |
|
| 81 | */ |
|
| 82 | private function fixScalarId($id, $className) |
|
| 83 | { |
|
| 84 | if (is_array($id)) { |
|
| 85 | return $id; |
|
| 86 | } |
|
| 87 | ||
| 88 | $id = (array)$id; |
|
| 89 | ||
| 90 | $identifiers = $this->getClassMetadata($className)->getIdentifierFieldNames(); |
|
| 91 | if (count($id) !== count($identifiers)) { |
|
| 92 | throw MappingException::invalidIdentifierStructure(); |
|
| 93 | } |
|
| 94 | ||
| 95 | return array_combine($identifiers, (array)$id); |
|
| 96 | } |
|
| 97 | ||
| 98 | /** |
|
| 99 | * {@inheritdoc} |
|
| @@ 86-100 (lines=15) @@ | ||
| 83 | * @return array |
|
| 84 | * @throws MappingException |
|
| 85 | */ |
|
| 86 | protected function fixScalarId($id, ApiMetadata $metadata) |
|
| 87 | { |
|
| 88 | if (is_array($id)) { |
|
| 89 | return $id; |
|
| 90 | } |
|
| 91 | ||
| 92 | $id = (array)$id; |
|
| 93 | ||
| 94 | $identifiers = $metadata->getIdentifierFieldNames(); |
|
| 95 | if (count($id) !== count($identifiers)) { |
|
| 96 | throw MappingException::invalidIdentifierStructure(); |
|
| 97 | } |
|
| 98 | ||
| 99 | return array_combine($identifiers, (array)$id); |
|
| 100 | } |
|
| 101 | } |
|
| 102 | ||