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