@@ -179,9 +179,9 @@ discard block |
||
| 179 | 179 | |
| 180 | 180 | $db = $this->recordManager->find(strtolower((string) $parts[1])); |
| 181 | 181 | $db->where($this->getName() . '_id = :id') |
| 182 | - ->setParameter('id', $this->__meta['id'], |
|
| 182 | + ->setParameter('id', $this->__meta['id'], |
|
| 183 | 183 | $this->determineIdType($this->__meta['id']) |
| 184 | - ); |
|
| 184 | + ); |
|
| 185 | 185 | |
| 186 | 186 | $result = $db->get(); |
| 187 | 187 | $this->set($key, $result); |
@@ -200,9 +200,9 @@ discard block |
||
| 200 | 200 | |
| 201 | 201 | $db = $this->recordManager->find($relTable); |
| 202 | 202 | $db->where($this->getName() . '_id = :id') |
| 203 | - ->setParameter('id', $this->__meta['id'], |
|
| 203 | + ->setParameter('id', $this->__meta['id'], |
|
| 204 | 204 | $this->determineIdType($this->__meta['id']) |
| 205 | - ); |
|
| 205 | + ); |
|
| 206 | 206 | |
| 207 | 207 | $relations = $db->get(); |
| 208 | 208 | $relIds = $this->extractRelationIds($relations, $targetTable); |
@@ -213,9 +213,9 @@ discard block |
||
| 213 | 213 | |
| 214 | 214 | $db = $this->recordManager->find($targetTable); |
| 215 | 215 | $db->where('id IN (:ids)') |
| 216 | - ->setParameter('ids', $relIds, |
|
| 216 | + ->setParameter('ids', $relIds, |
|
| 217 | 217 | $this->determineIdsType($relIds) |
| 218 | - ); |
|
| 218 | + ); |
|
| 219 | 219 | |
| 220 | 220 | $result = $db->get(); |
| 221 | 221 | |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | $db = $this->recordManager->find(strtolower((string) $parts[1])); |
| 181 | - $db->where($this->getName() . '_id = :id') |
|
| 181 | + $db->where($this->getName().'_id = :id') |
|
| 182 | 182 | ->setParameter('id', $this->__meta['id'], |
| 183 | 183 | $this->determineIdType($this->__meta['id']) |
| 184 | 184 | ); |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | $relTable = $this->getRelationTable($targetTable); |
| 200 | 200 | |
| 201 | 201 | $db = $this->recordManager->find($relTable); |
| 202 | - $db->where($this->getName() . '_id = :id') |
|
| 202 | + $db->where($this->getName().'_id = :id') |
|
| 203 | 203 | ->setParameter('id', $this->__meta['id'], |
| 204 | 204 | $this->determineIdType($this->__meta['id']) |
| 205 | 205 | ); |
@@ -225,12 +225,12 @@ discard block |
||
| 225 | 225 | |
| 226 | 226 | private function getRelationTable(string $targetTable): string |
| 227 | 227 | { |
| 228 | - $cacheKey = $this->table . '_' . $targetTable; |
|
| 228 | + $cacheKey = $this->table.'_'.$targetTable; |
|
| 229 | 229 | |
| 230 | 230 | if (!isset($this->relationTableCache[$cacheKey])) { |
| 231 | 231 | $this->relationTableCache[$cacheKey] = $this->tableManager->tableExists($cacheKey) |
| 232 | 232 | ? $cacheKey |
| 233 | - : $targetTable . '_' . $this->table; |
|
| 233 | + : $targetTable.'_'.$this->table; |
|
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | return $this->relationTableCache[$cacheKey]; |
@@ -238,8 +238,8 @@ discard block |
||
| 238 | 238 | |
| 239 | 239 | private function extractRelationIds(Collection $relations, string $targetTable): array |
| 240 | 240 | { |
| 241 | - return $relations->map(function ($relation) use ($targetTable) { |
|
| 242 | - $key = $targetTable . '_id'; |
|
| 241 | + return $relations->map(function($relation) use ($targetTable) { |
|
| 242 | + $key = $targetTable.'_id'; |
|
| 243 | 243 | |
| 244 | 244 | return $relation->$key; |
| 245 | 245 | })->toArray(); |
@@ -266,8 +266,8 @@ discard block |
||
| 266 | 266 | } |
| 267 | 267 | |
| 268 | 268 | // Handle foreign key relations |
| 269 | - if (array_key_exists($key . '_id', $this->__properties['self'])) { |
|
| 270 | - $result = $this->recordManager->getById($key, $this->__properties['self'][$key . '_id']); |
|
| 269 | + if (array_key_exists($key.'_id', $this->__properties['self'])) { |
|
| 270 | + $result = $this->recordManager->getById($key, $this->__properties['self'][$key.'_id']); |
|
| 271 | 271 | $this->set($key, $result); |
| 272 | 272 | |
| 273 | 273 | return $result; |
@@ -422,7 +422,7 @@ discard block |
||
| 422 | 422 | * |
| 423 | 423 | * @throws Exception\InvalidModelException |
| 424 | 424 | */ |
| 425 | - private function createCollection(?Collection $collection, array|Collection $models): Collection |
|
| 425 | + private function createCollection(?Collection $collection, array | Collection $models): Collection |
|
| 426 | 426 | { |
| 427 | 427 | if (is_null($collection)) { |
| 428 | 428 | $collection = Collection::fromIterable([]); |
@@ -453,8 +453,8 @@ discard block |
||
| 453 | 453 | |
| 454 | 454 | private function handleModelRelation(string $key, Model $val): void |
| 455 | 455 | { |
| 456 | - if (isset($this->__properties['all'][$key . '_id'])) { |
|
| 457 | - unset($this->__properties['all'][$key . '_id']); |
|
| 456 | + if (isset($this->__properties['all'][$key.'_id'])) { |
|
| 457 | + unset($this->__properties['all'][$key.'_id']); |
|
| 458 | 458 | } |
| 459 | 459 | |
| 460 | 460 | $this->__meta['foreign_models']['oto'] = $this->createCollection( |
@@ -501,7 +501,7 @@ discard block |
||
| 501 | 501 | /** |
| 502 | 502 | * Determines the ParameterType for an ID value |
| 503 | 503 | */ |
| 504 | - private function determineIdType(int|string $id): ParameterType |
|
| 504 | + private function determineIdType(int | string $id): ParameterType |
|
| 505 | 505 | { |
| 506 | 506 | return is_int($id) ? ParameterType::INTEGER : ParameterType::STRING; |
| 507 | 507 | } |