@@ -40,7 +40,7 @@ |
||
| 40 | 40 | // Try to load specific model class first if modelNamespace is not empty |
| 41 | 41 | $namespace = $this->config->getModelNamespace(); |
| 42 | 42 | if (!empty($namespace)) { |
| 43 | - $modelClass = $namespace . ucfirst($name); |
|
| 43 | + $modelClass = $namespace.ucfirst($name); |
|
| 44 | 44 | if (class_exists($modelClass)) { |
| 45 | 45 | return $this->container->make($modelClass); |
| 46 | 46 | } |
@@ -66,7 +66,7 @@ |
||
| 66 | 66 | |
| 67 | 67 | private function createModelManager(): void |
| 68 | 68 | { |
| 69 | - $this->container->set(ModelManager::class, fn (): ModelManager => new ModelManager($this->container,$this->container->get(Config::class))); |
|
| 69 | + $this->container->set(ModelManager::class, fn (): ModelManager => new ModelManager($this->container, $this->container->get(Config::class))); |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | private function createConfig(bool $useUUID, string $modelNamespace): void |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | $db = $this->recordManager->find(strtolower((string) $parts[1])); |
| 240 | - $db->where($this->getName() . '_id = :id') |
|
| 240 | + $db->where($this->getName().'_id = :id') |
|
| 241 | 241 | ->setParameter( |
| 242 | 242 | 'id', |
| 243 | 243 | $this->__meta['id'], |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | $relTable = $this->getRelationTable($targetTable); |
| 261 | 261 | |
| 262 | 262 | $db = $this->recordManager->find($relTable); |
| 263 | - $db->where($this->getName() . '_id = :id') |
|
| 263 | + $db->where($this->getName().'_id = :id') |
|
| 264 | 264 | ->setParameter( |
| 265 | 265 | 'id', |
| 266 | 266 | $this->__meta['id'], |
@@ -291,12 +291,12 @@ discard block |
||
| 291 | 291 | |
| 292 | 292 | private function getRelationTable(string $targetTable): string |
| 293 | 293 | { |
| 294 | - $cacheKey = $this->table . '_' . $targetTable; |
|
| 294 | + $cacheKey = $this->table.'_'.$targetTable; |
|
| 295 | 295 | |
| 296 | 296 | if (!isset($this->relationTableCache[$cacheKey])) { |
| 297 | 297 | $this->relationTableCache[$cacheKey] = $this->tableManager->tableExists($cacheKey) |
| 298 | 298 | ? $cacheKey |
| 299 | - : $targetTable . '_' . $this->table; |
|
| 299 | + : $targetTable.'_'.$this->table; |
|
| 300 | 300 | } |
| 301 | 301 | |
| 302 | 302 | return $this->relationTableCache[$cacheKey]; |
@@ -304,8 +304,8 @@ discard block |
||
| 304 | 304 | |
| 305 | 305 | private function extractRelationIds(Collection $relations, string $targetTable): array |
| 306 | 306 | { |
| 307 | - return $relations->map(function ($relation) use ($targetTable) { |
|
| 308 | - $key = $targetTable . '_id'; |
|
| 307 | + return $relations->map(function($relation) use ($targetTable) { |
|
| 308 | + $key = $targetTable.'_id'; |
|
| 309 | 309 | |
| 310 | 310 | return $relation->$key; |
| 311 | 311 | })->toArray(); |
@@ -332,8 +332,8 @@ discard block |
||
| 332 | 332 | } |
| 333 | 333 | |
| 334 | 334 | // Handle foreign key relations |
| 335 | - if (array_key_exists($key . '_id', $this->__properties['self'])) { |
|
| 336 | - $result = $this->recordManager->getById($key, $this->__properties['self'][$key . '_id']); |
|
| 335 | + if (array_key_exists($key.'_id', $this->__properties['self'])) { |
|
| 336 | + $result = $this->recordManager->getById($key, $this->__properties['self'][$key.'_id']); |
|
| 337 | 337 | $this->set($key, $result); |
| 338 | 338 | |
| 339 | 339 | return $result; |
@@ -491,7 +491,7 @@ discard block |
||
| 491 | 491 | * |
| 492 | 492 | * @throws Exception\InvalidModelException |
| 493 | 493 | */ |
| 494 | - private function createCollection(?Collection $collection, array|Collection $models): Collection |
|
| 494 | + private function createCollection(?Collection $collection, array | Collection $models): Collection |
|
| 495 | 495 | { |
| 496 | 496 | if (is_null($collection)) { |
| 497 | 497 | $collection = Collection::fromIterable([]); |
@@ -522,8 +522,8 @@ discard block |
||
| 522 | 522 | |
| 523 | 523 | private function handleModelRelation(string $key, Model $val): void |
| 524 | 524 | { |
| 525 | - if (isset($this->__properties['all'][$key . '_id'])) { |
|
| 526 | - unset($this->__properties['all'][$key . '_id']); |
|
| 525 | + if (isset($this->__properties['all'][$key.'_id'])) { |
|
| 526 | + unset($this->__properties['all'][$key.'_id']); |
|
| 527 | 527 | } |
| 528 | 528 | |
| 529 | 529 | $this->__meta['foreign_models']['oto'] = $this->createCollection( |
@@ -572,7 +572,7 @@ discard block |
||
| 572 | 572 | /** |
| 573 | 573 | * Determines the ParameterType for an ID value. |
| 574 | 574 | */ |
| 575 | - private function determineIdType(int|string $id): ParameterType |
|
| 575 | + private function determineIdType(int | string $id): ParameterType |
|
| 576 | 576 | { |
| 577 | 577 | return is_int($id) ? ParameterType::INTEGER : ParameterType::STRING; |
| 578 | 578 | } |