| @@ 129-141 (lines=13) @@ | ||
| 126 | $mapping['fetch'] = constant(ApiMetadata::class . '::FETCH_' . $association['fetch']); |
|
| 127 | } |
|
| 128 | switch ($type) { |
|
| 129 | case 'oneToOne': |
|
| 130 | $mapping['type'] = EntityMetadata::ONE_TO_ONE; |
|
| 131 | if (isset($associationIds[$mapping['field']])) { |
|
| 132 | $mapping['id'] = true; |
|
| 133 | } |
|
| 134 | if (array_key_exists('mappedBy', $association)) { |
|
| 135 | $mapping['mappedBy'] = $association['mappedBy']; |
|
| 136 | } |
|
| 137 | if (array_key_exists('inversedBy', $association)) { |
|
| 138 | $mapping['inversedBy'] = $association['inversedBy']; |
|
| 139 | } |
|
| 140 | $metadata->mapOneToOne($mapping); |
|
| 141 | break; |
|
| 142 | case 'manyToOne': |
|
| 143 | $mapping['type'] = EntityMetadata::MANY_TO_ONE; |
|
| 144 | if (array_key_exists('inversedBy', $association)) { |
|
| @@ 149-161 (lines=13) @@ | ||
| 146 | } |
|
| 147 | $metadata->mapManyToOne($mapping); |
|
| 148 | break; |
|
| 149 | case 'oneToMany': |
|
| 150 | $mapping['type'] = EntityMetadata::ONE_TO_MANY; |
|
| 151 | if (array_key_exists('mappedBy', $association)) { |
|
| 152 | $mapping['mappedBy'] = $association['mappedBy']; |
|
| 153 | } |
|
| 154 | if (array_key_exists('orderBy', $association)) { |
|
| 155 | $mapping['orderBy'] = $association['orderBy']; |
|
| 156 | } |
|
| 157 | if (array_key_exists('indexBy', $association)) { |
|
| 158 | $mapping['indexBy'] = $association['indexBy']; |
|
| 159 | } |
|
| 160 | $metadata->mapOneToMany($mapping); |
|
| 161 | break; |
|
| 162 | } |
|
| 163 | } |
|
| 164 | ||