@@ -34,11 +34,11 @@ |
||
| 34 | 34 | // We could do the casting to array / json the same way, and it would |
| 35 | 35 | |
| 36 | 36 | |
| 37 | - if(property_exists($this, $key)) { |
|
| 37 | + if (property_exists($this, $key)) { |
|
| 38 | 38 | return $this->$key; |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - if(array_key_exists($key, $this->attributes)) |
|
| 41 | + if (array_key_exists($key, $this->attributes)) |
|
| 42 | 42 | { |
| 43 | 43 | return $this->attributes[$key]; |
| 44 | 44 | } |
@@ -397,7 +397,7 @@ discard block |
||
| 397 | 397 | if (!is_null($this->sequence)) { |
| 398 | 398 | return $this->sequence; |
| 399 | 399 | } else { |
| 400 | - return $this->getTable() . '_id_seq'; |
|
| 400 | + return $this->getTable().'_id_seq'; |
|
| 401 | 401 | } |
| 402 | 402 | } |
| 403 | 403 | |
@@ -598,7 +598,7 @@ discard block |
||
| 598 | 598 | */ |
| 599 | 599 | public function getQualifiedKeyName() |
| 600 | 600 | { |
| 601 | - return $this->getTable() . '.' . $this->getKeyName(); |
|
| 601 | + return $this->getTable().'.'.$this->getKeyName(); |
|
| 602 | 602 | } |
| 603 | 603 | |
| 604 | 604 | /** |
@@ -679,7 +679,7 @@ discard block |
||
| 679 | 679 | */ |
| 680 | 680 | public function getForeignKey() |
| 681 | 681 | { |
| 682 | - return snake_case(class_basename($this->getClass())) . '_id'; |
|
| 682 | + return snake_case(class_basename($this->getClass())).'_id'; |
|
| 683 | 683 | } |
| 684 | 684 | |
| 685 | 685 | /** |
@@ -755,11 +755,11 @@ discard block |
||
| 755 | 755 | |
| 756 | 756 | // This relationship will always be eager loaded, as proxying it would |
| 757 | 757 | // mean having an object that doesn't actually exists. |
| 758 | - if(! in_array($relation, $this->with)) { |
|
| 758 | + if (!in_array($relation, $this->with)) { |
|
| 759 | 759 | $this->with[] = $relation; |
| 760 | 760 | } |
| 761 | 761 | |
| 762 | - return new HasOne($relatedMapper, $entity, $relatedMap->getTable() . '.' . $foreignKey, $localKey); |
|
| 762 | + return new HasOne($relatedMapper, $entity, $relatedMap->getTable().'.'.$foreignKey, $localKey); |
|
| 763 | 763 | } |
| 764 | 764 | |
| 765 | 765 | /** |
@@ -794,11 +794,11 @@ discard block |
||
| 794 | 794 | |
| 795 | 795 | // This relationship will always be eager loaded, as proxying it would |
| 796 | 796 | // mean having an object that doesn't actually exists. |
| 797 | - if(! in_array($relation, $this->with)) { |
|
| 797 | + if (!in_array($relation, $this->with)) { |
|
| 798 | 798 | $this->with[] = $relation; |
| 799 | 799 | } |
| 800 | 800 | |
| 801 | - return new MorphOne($relatedMapper, $entity, $table . '.' . $type, $table . '.' . $id, $localKey); |
|
| 801 | + return new MorphOne($relatedMapper, $entity, $table.'.'.$type, $table.'.'.$id, $localKey); |
|
| 802 | 802 | } |
| 803 | 803 | |
| 804 | 804 | /** |
@@ -825,7 +825,7 @@ discard block |
||
| 825 | 825 | // foreign key name by using the name of the relationship function, which |
| 826 | 826 | // when combined with an "_id" should conventionally match the columns. |
| 827 | 827 | if (is_null($foreignKey)) { |
| 828 | - $foreignKey = snake_case($relation) . '_id'; |
|
| 828 | + $foreignKey = snake_case($relation).'_id'; |
|
| 829 | 829 | } |
| 830 | 830 | |
| 831 | 831 | $this->localForeignKeys[$relation] = $foreignKey; |
@@ -918,7 +918,7 @@ discard block |
||
| 918 | 918 | |
| 919 | 919 | $relatedMapper = Manager::getInstance()->mapper($related); |
| 920 | 920 | |
| 921 | - $table = $relatedMapper->getEntityMap()->getTable() . '.' . $foreignKey; |
|
| 921 | + $table = $relatedMapper->getEntityMap()->getTable().'.'.$foreignKey; |
|
| 922 | 922 | |
| 923 | 923 | $localKey = $localKey ?: $this->getKeyName(); |
| 924 | 924 | |
@@ -997,7 +997,7 @@ discard block |
||
| 997 | 997 | $this->manyRelations[] = $relation; |
| 998 | 998 | $this->foreignRelations[] = $relation; |
| 999 | 999 | |
| 1000 | - return new MorphMany($relatedMapper, $entity, $table . '.' . $type, $table . '.' . $id, $localKey); |
|
| 1000 | + return new MorphMany($relatedMapper, $entity, $table.'.'.$type, $table.'.'.$id, $localKey); |
|
| 1001 | 1001 | } |
| 1002 | 1002 | |
| 1003 | 1003 | /** |
@@ -1069,7 +1069,7 @@ discard block |
||
| 1069 | 1069 | // First, we will need to determine the foreign key and "other key" for the |
| 1070 | 1070 | // relationship. Once we have determined the keys we will make the query |
| 1071 | 1071 | // instances, as well as the relationship instances we need for these. |
| 1072 | - $foreignKey = $foreignKey ?: $name . '_id'; |
|
| 1072 | + $foreignKey = $foreignKey ?: $name.'_id'; |
|
| 1073 | 1073 | |
| 1074 | 1074 | $relatedMapper = Manager::getInstance()->mapper($related); |
| 1075 | 1075 | |
@@ -1106,7 +1106,7 @@ discard block |
||
| 1106 | 1106 | // For the inverse of the polymorphic many-to-many relations, we will change |
| 1107 | 1107 | // the way we determine the foreign and other keys, as it is the opposite |
| 1108 | 1108 | // of the morph-to-many method since we're figuring out these inverses. |
| 1109 | - $otherKey = $otherKey ?: $name . '_id'; |
|
| 1109 | + $otherKey = $otherKey ?: $name.'_id'; |
|
| 1110 | 1110 | |
| 1111 | 1111 | return $this->morphToMany($entity, $related, $name, $table, $foreignKey, $otherKey, true); |
| 1112 | 1112 | } |
@@ -1146,9 +1146,9 @@ discard block |
||
| 1146 | 1146 | */ |
| 1147 | 1147 | protected function getMorphs($name, $type, $id) |
| 1148 | 1148 | { |
| 1149 | - $type = $type ?: $name . '_type'; |
|
| 1149 | + $type = $type ?: $name.'_type'; |
|
| 1150 | 1150 | |
| 1151 | - $id = $id ?: $name . '_id'; |
|
| 1151 | + $id = $id ?: $name.'_id'; |
|
| 1152 | 1152 | |
| 1153 | 1153 | return [$type, $id]; |
| 1154 | 1154 | } |
@@ -1297,7 +1297,7 @@ discard block |
||
| 1297 | 1297 | public function __call($method, $parameters) |
| 1298 | 1298 | { |
| 1299 | 1299 | if (!array_key_exists($method, $this->dynamicRelationships)) { |
| 1300 | - throw new Exception(get_class($this) . " has no method $method"); |
|
| 1300 | + throw new Exception(get_class($this)." has no method $method"); |
|
| 1301 | 1301 | } |
| 1302 | 1302 | |
| 1303 | 1303 | // Add $this to parameters so the closure can call relationship method on the map. |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | $attributes = $this->getEntityAttributes(); |
| 85 | 85 | $proxies = []; |
| 86 | 86 | |
| 87 | - if(is_null($relations)) { |
|
| 87 | + if (is_null($relations)) { |
|
| 88 | 88 | $relations = $this->getRelationsToProxy(); |
| 89 | 89 | } |
| 90 | 90 | |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | // We first look if we need to build the proxy on the relationship. |
| 93 | 93 | // If the key is handled locally and we know it not to be set, |
| 94 | 94 | // we'll set the relationship to null |
| 95 | - if (! $this->relationNeedsProxy($relation, $attributes)) { |
|
| 95 | + if (!$this->relationNeedsProxy($relation, $attributes)) { |
|
| 96 | 96 | $proxies[$relation] = null; |
| 97 | 97 | } |
| 98 | 98 | else { |
@@ -135,23 +135,23 @@ discard block |
||
| 135 | 135 | */ |
| 136 | 136 | protected function relationNeedsProxy($relation, $attributes) |
| 137 | 137 | { |
| 138 | - if(in_array($relation, $this->entityMap->getRelationshipsWithoutProxy())) { |
|
| 138 | + if (in_array($relation, $this->entityMap->getRelationshipsWithoutProxy())) { |
|
| 139 | 139 | return false; |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | $localKey = $this->entityMap->getLocalKeys($relation); |
| 143 | 143 | |
| 144 | - if(is_null($localKey)) return true; |
|
| 144 | + if (is_null($localKey)) return true; |
|
| 145 | 145 | |
| 146 | - if(is_array($localKey)) { |
|
| 146 | + if (is_array($localKey)) { |
|
| 147 | 147 | $localKey = $localKey['id']; |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | - if(! isset($attributes[$localKey])) { |
|
| 150 | + if (!isset($attributes[$localKey])) { |
|
| 151 | 151 | return false; |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | - if(is_null($attributes[$localKey])) { |
|
| 154 | + if (is_null($attributes[$localKey])) { |
|
| 155 | 155 | return false; |
| 156 | 156 | } |
| 157 | 157 | |
@@ -365,7 +365,7 @@ discard block |
||
| 365 | 365 | */ |
| 366 | 366 | public function getEntityHash() |
| 367 | 367 | { |
| 368 | - return $this->getEntityClass() . '.' . $this->getEntityId(); |
|
| 368 | + return $this->getEntityClass().'.'.$this->getEntityId(); |
|
| 369 | 369 | } |
| 370 | 370 | |
| 371 | 371 | /** |
@@ -558,7 +558,7 @@ discard block |
||
| 558 | 558 | unset($attributes[$relation]); |
| 559 | 559 | } |
| 560 | 560 | |
| 561 | - if($this->entityMap->getInheritanceType() == 'single_table') { |
|
| 561 | + if ($this->entityMap->getInheritanceType() == 'single_table') { |
|
| 562 | 562 | $attributes = $this->addDiscriminatorColumn($attributes); |
| 563 | 563 | } |
| 564 | 564 | |
@@ -580,14 +580,14 @@ discard block |
||
| 580 | 580 | $discriminatorColumn = $this->entityMap->getDiscriminatorColumn(); |
| 581 | 581 | $entityClass = $this->entityMap->getClass(); |
| 582 | 582 | |
| 583 | - if(! array_key_exists($discriminatorColumn, $attributes)) { |
|
| 583 | + if (!array_key_exists($discriminatorColumn, $attributes)) { |
|
| 584 | 584 | |
| 585 | 585 | // Use key if present in discriminatorMap |
| 586 | 586 | $map = $this->entityMap->getDiscriminatorColumnMap(); |
| 587 | 587 | |
| 588 | 588 | $type = array_search($entityClass, $map); |
| 589 | 589 | |
| 590 | - if($type === false) { |
|
| 590 | + if ($type === false) { |
|
| 591 | 591 | // Use entity FQDN if no corresponding key is set |
| 592 | 592 | $attributes[$discriminatorColumn] = $entityClass; |
| 593 | 593 | } |
@@ -624,7 +624,7 @@ discard block |
||
| 624 | 624 | $prefix = snake_case(class_basename($embed)); |
| 625 | 625 | |
| 626 | 626 | foreach ($valueObjectAttributes as $key=>$value) { |
| 627 | - $valueObjectAttributes[$prefix . '_' . $key] = $value; |
|
| 627 | + $valueObjectAttributes[$prefix.'_'.$key] = $value; |
|
| 628 | 628 | unset($valueObjectAttributes[$key]); |
| 629 | 629 | } |
| 630 | 630 | |
@@ -685,7 +685,7 @@ discard block |
||
| 685 | 685 | } |
| 686 | 686 | } |
| 687 | 687 | |
| 688 | - if ( ! is_null($this->parent)) { |
|
| 688 | + if (!is_null($this->parent)) { |
|
| 689 | 689 | $foreignKeys = $foreignKeys + $this->getForeignKeyAttributesFromParent(); |
| 690 | 690 | } |
| 691 | 691 | |
@@ -914,7 +914,7 @@ discard block |
||
| 914 | 914 | */ |
| 915 | 915 | protected function getEntityHashesFromRelation($relation) |
| 916 | 916 | { |
| 917 | - return array_map(function ($aggregate) { |
|
| 917 | + return array_map(function($aggregate) { |
|
| 918 | 918 | return $aggregate->getEntityHash(); |
| 919 | 919 | }, $this->relationships[$relation]); |
| 920 | 920 | } |
@@ -46,13 +46,13 @@ |
||
| 46 | 46 | { |
| 47 | 47 | $factory = new LazyLoadingValueHolderFactory(); |
| 48 | 48 | |
| 49 | - $initializer = function (& $wrappedObject, LazyLoadingInterface $proxy, $method, array $parameters, & $initializer) use ($entity, $relation) { |
|
| 49 | + $initializer = function(& $wrappedObject, LazyLoadingInterface $proxy, $method, array $parameters, & $initializer) use ($entity, $relation) { |
|
| 50 | 50 | |
| 51 | 51 | $entityMap = Manager::getMapper($entity)->getEntityMap(); |
| 52 | 52 | |
| 53 | 53 | $wrappedObject = $entityMap->$relation($entity)->getResults($relation); |
| 54 | 54 | |
| 55 | - $initializer = null; // disable initialization |
|
| 55 | + $initializer = null; // disable initialization |
|
| 56 | 56 | return true; // confirm that initialization occurred correctly |
| 57 | 57 | }; |
| 58 | 58 | |
@@ -50,7 +50,7 @@ |
||
| 50 | 50 | */ |
| 51 | 51 | public function initializeProxy() : bool |
| 52 | 52 | { |
| 53 | - if($this->isProxyInitialized() ) return true; |
|
| 53 | + if ($this->isProxyInitialized()) return true; |
|
| 54 | 54 | |
| 55 | 55 | $relation = $this->relationshipMethod; |
| 56 | 56 | $entity = $this->parentEntity; |