@@ -44,14 +44,14 @@ discard block |
||
| 44 | 44 | */ |
| 45 | 45 | public static function registerAutoloadDirectory($directory) |
| 46 | 46 | { |
| 47 | - if (!class_exists('Doctrine\Common\ClassLoader', false)) { |
|
| 48 | - require_once $directory . "/Doctrine/Common/ClassLoader.php"; |
|
| 47 | + if ( ! class_exists('Doctrine\Common\ClassLoader', false)) { |
|
| 48 | + require_once $directory."/Doctrine/Common/ClassLoader.php"; |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | $loader = new ClassLoader("Doctrine", $directory); |
| 52 | 52 | $loader->register(); |
| 53 | 53 | |
| 54 | - $loader = new ClassLoader("Symfony\Component", $directory . "/Doctrine"); |
|
| 54 | + $loader = new ClassLoader("Symfony\Component", $directory."/Doctrine"); |
|
| 55 | 55 | $loader->register(); |
| 56 | 56 | } |
| 57 | 57 | |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | $namespace .= ':'; |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | - $cache->setNamespace($namespace . 'dc2_' . md5($proxyDir) . '_'); // to avoid collisions |
|
| 153 | + $cache->setNamespace($namespace.'dc2_'.md5($proxyDir).'_'); // to avoid collisions |
|
| 154 | 154 | |
| 155 | 155 | return $cache; |
| 156 | 156 | } |
@@ -89,66 +89,66 @@ discard block |
||
| 89 | 89 | $cmf = $this->em->getMetadataFactory(); |
| 90 | 90 | |
| 91 | 91 | foreach ($class->fieldMappings as $fieldName => $mapping) { |
| 92 | - if (!Type::hasType($mapping['type'])) { |
|
| 93 | - $ce[] = "The field '" . $class->name . "#" . $fieldName."' uses a non-existent type '" . $mapping['type'] . "'."; |
|
| 92 | + if ( ! Type::hasType($mapping['type'])) { |
|
| 93 | + $ce[] = "The field '".$class->name."#".$fieldName."' uses a non-existent type '".$mapping['type']."'."; |
|
| 94 | 94 | } |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | foreach ($class->associationMappings as $fieldName => $assoc) { |
| 98 | - if (!class_exists($assoc['targetEntity']) || $cmf->isTransient($assoc['targetEntity'])) { |
|
| 99 | - $ce[] = "The target entity '" . $assoc['targetEntity'] . "' specified on " . $class->name . '#' . $fieldName . ' is unknown or not an entity.'; |
|
| 98 | + if ( ! class_exists($assoc['targetEntity']) || $cmf->isTransient($assoc['targetEntity'])) { |
|
| 99 | + $ce[] = "The target entity '".$assoc['targetEntity']."' specified on ".$class->name.'#'.$fieldName.' is unknown or not an entity.'; |
|
| 100 | 100 | |
| 101 | 101 | return $ce; |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | if ($assoc['mappedBy'] && $assoc['inversedBy']) { |
| 105 | - $ce[] = "The association " . $class . "#" . $fieldName . " cannot be defined as both inverse and owning."; |
|
| 105 | + $ce[] = "The association ".$class."#".$fieldName." cannot be defined as both inverse and owning."; |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | $targetMetadata = $cmf->getMetadataFor($assoc['targetEntity']); |
| 109 | 109 | |
| 110 | 110 | if (isset($assoc['id']) && $targetMetadata->containsForeignIdentifier) { |
| 111 | - $ce[] = "Cannot map association '" . $class->name. "#". $fieldName ." as identifier, because " . |
|
| 112 | - "the target entity '". $targetMetadata->name . "' also maps an association as identifier."; |
|
| 111 | + $ce[] = "Cannot map association '".$class->name."#".$fieldName." as identifier, because ". |
|
| 112 | + "the target entity '".$targetMetadata->name."' also maps an association as identifier."; |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | if ($assoc['mappedBy']) { |
| 116 | 116 | if ($targetMetadata->hasField($assoc['mappedBy'])) { |
| 117 | - $ce[] = "The association " . $class->name . "#" . $fieldName . " refers to the owning side ". |
|
| 118 | - "field " . $assoc['targetEntity'] . "#" . $assoc['mappedBy'] . " which is not defined as association, but as field."; |
|
| 117 | + $ce[] = "The association ".$class->name."#".$fieldName." refers to the owning side ". |
|
| 118 | + "field ".$assoc['targetEntity']."#".$assoc['mappedBy']." which is not defined as association, but as field."; |
|
| 119 | 119 | } |
| 120 | - if (!$targetMetadata->hasAssociation($assoc['mappedBy'])) { |
|
| 121 | - $ce[] = "The association " . $class->name . "#" . $fieldName . " refers to the owning side ". |
|
| 122 | - "field " . $assoc['targetEntity'] . "#" . $assoc['mappedBy'] . " which does not exist."; |
|
| 120 | + if ( ! $targetMetadata->hasAssociation($assoc['mappedBy'])) { |
|
| 121 | + $ce[] = "The association ".$class->name."#".$fieldName." refers to the owning side ". |
|
| 122 | + "field ".$assoc['targetEntity']."#".$assoc['mappedBy']." which does not exist."; |
|
| 123 | 123 | } elseif ($targetMetadata->associationMappings[$assoc['mappedBy']]['inversedBy'] == null) { |
| 124 | - $ce[] = "The field " . $class->name . "#" . $fieldName . " is on the inverse side of a ". |
|
| 124 | + $ce[] = "The field ".$class->name."#".$fieldName." is on the inverse side of a ". |
|
| 125 | 125 | "bi-directional relationship, but the specified mappedBy association on the target-entity ". |
| 126 | - $assoc['targetEntity'] . "#" . $assoc['mappedBy'] . " does not contain the required ". |
|
| 127 | - "'inversedBy=\"" . $fieldName . "\"' attribute."; |
|
| 126 | + $assoc['targetEntity']."#".$assoc['mappedBy']." does not contain the required ". |
|
| 127 | + "'inversedBy=\"".$fieldName."\"' attribute."; |
|
| 128 | 128 | } elseif ($targetMetadata->associationMappings[$assoc['mappedBy']]['inversedBy'] != $fieldName) { |
| 129 | - $ce[] = "The mappings " . $class->name . "#" . $fieldName . " and " . |
|
| 130 | - $assoc['targetEntity'] . "#" . $assoc['mappedBy'] . " are ". |
|
| 129 | + $ce[] = "The mappings ".$class->name."#".$fieldName." and ". |
|
| 130 | + $assoc['targetEntity']."#".$assoc['mappedBy']." are ". |
|
| 131 | 131 | "inconsistent with each other."; |
| 132 | 132 | } |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | if ($assoc['inversedBy']) { |
| 136 | 136 | if ($targetMetadata->hasField($assoc['inversedBy'])) { |
| 137 | - $ce[] = "The association " . $class->name . "#" . $fieldName . " refers to the inverse side ". |
|
| 138 | - "field " . $assoc['targetEntity'] . "#" . $assoc['inversedBy'] . " which is not defined as association."; |
|
| 137 | + $ce[] = "The association ".$class->name."#".$fieldName." refers to the inverse side ". |
|
| 138 | + "field ".$assoc['targetEntity']."#".$assoc['inversedBy']." which is not defined as association."; |
|
| 139 | 139 | } |
| 140 | 140 | |
| 141 | - if (!$targetMetadata->hasAssociation($assoc['inversedBy'])) { |
|
| 142 | - $ce[] = "The association " . $class->name . "#" . $fieldName . " refers to the inverse side ". |
|
| 143 | - "field " . $assoc['targetEntity'] . "#" . $assoc['inversedBy'] . " which does not exist."; |
|
| 141 | + if ( ! $targetMetadata->hasAssociation($assoc['inversedBy'])) { |
|
| 142 | + $ce[] = "The association ".$class->name."#".$fieldName." refers to the inverse side ". |
|
| 143 | + "field ".$assoc['targetEntity']."#".$assoc['inversedBy']." which does not exist."; |
|
| 144 | 144 | } elseif ($targetMetadata->associationMappings[$assoc['inversedBy']]['mappedBy'] == null) { |
| 145 | - $ce[] = "The field " . $class->name . "#" . $fieldName . " is on the owning side of a ". |
|
| 145 | + $ce[] = "The field ".$class->name."#".$fieldName." is on the owning side of a ". |
|
| 146 | 146 | "bi-directional relationship, but the specified mappedBy association on the target-entity ". |
| 147 | - $assoc['targetEntity'] . "#" . $assoc['mappedBy'] . " does not contain the required ". |
|
| 147 | + $assoc['targetEntity']."#".$assoc['mappedBy']." does not contain the required ". |
|
| 148 | 148 | "'inversedBy' attribute."; |
| 149 | 149 | } elseif ($targetMetadata->associationMappings[$assoc['inversedBy']]['mappedBy'] != $fieldName) { |
| 150 | - $ce[] = "The mappings " . $class->name . "#" . $fieldName . " and " . |
|
| 151 | - $assoc['targetEntity'] . "#" . $assoc['inversedBy'] . " are ". |
|
| 150 | + $ce[] = "The mappings ".$class->name."#".$fieldName." and ". |
|
| 151 | + $assoc['targetEntity']."#".$assoc['inversedBy']." are ". |
|
| 152 | 152 | "inconsistent with each other."; |
| 153 | 153 | } |
| 154 | 154 | |
@@ -156,14 +156,14 @@ discard block |
||
| 156 | 156 | if (array_key_exists($assoc['inversedBy'], $targetMetadata->associationMappings)) { |
| 157 | 157 | $targetAssoc = $targetMetadata->associationMappings[$assoc['inversedBy']]; |
| 158 | 158 | if ($assoc['type'] == ClassMetadataInfo::ONE_TO_ONE && $targetAssoc['type'] !== ClassMetadataInfo::ONE_TO_ONE) { |
| 159 | - $ce[] = "If association " . $class->name . "#" . $fieldName . " is one-to-one, then the inversed " . |
|
| 160 | - "side " . $targetMetadata->name . "#" . $assoc['inversedBy'] . " has to be one-to-one as well."; |
|
| 159 | + $ce[] = "If association ".$class->name."#".$fieldName." is one-to-one, then the inversed ". |
|
| 160 | + "side ".$targetMetadata->name."#".$assoc['inversedBy']." has to be one-to-one as well."; |
|
| 161 | 161 | } elseif ($assoc['type'] == ClassMetadataInfo::MANY_TO_ONE && $targetAssoc['type'] !== ClassMetadataInfo::ONE_TO_MANY) { |
| 162 | - $ce[] = "If association " . $class->name . "#" . $fieldName . " is many-to-one, then the inversed " . |
|
| 163 | - "side " . $targetMetadata->name . "#" . $assoc['inversedBy'] . " has to be one-to-many."; |
|
| 162 | + $ce[] = "If association ".$class->name."#".$fieldName." is many-to-one, then the inversed ". |
|
| 163 | + "side ".$targetMetadata->name."#".$assoc['inversedBy']." has to be one-to-many."; |
|
| 164 | 164 | } elseif ($assoc['type'] == ClassMetadataInfo::MANY_TO_MANY && $targetAssoc['type'] !== ClassMetadataInfo::MANY_TO_MANY) { |
| 165 | - $ce[] = "If association " . $class->name . "#" . $fieldName . " is many-to-many, then the inversed " . |
|
| 166 | - "side " . $targetMetadata->name . "#" . $assoc['inversedBy'] . " has to be many-to-many as well."; |
|
| 165 | + $ce[] = "If association ".$class->name."#".$fieldName." is many-to-many, then the inversed ". |
|
| 166 | + "side ".$targetMetadata->name."#".$assoc['inversedBy']." has to be many-to-many as well."; |
|
| 167 | 167 | } |
| 168 | 168 | } |
| 169 | 169 | } |
@@ -172,8 +172,8 @@ discard block |
||
| 172 | 172 | if ($assoc['type'] == ClassMetadataInfo::MANY_TO_MANY) { |
| 173 | 173 | $identifierColumns = $class->getIdentifierColumnNames(); |
| 174 | 174 | foreach ($assoc['joinTable']['joinColumns'] as $joinColumn) { |
| 175 | - if (!in_array($joinColumn['referencedColumnName'], $identifierColumns)) { |
|
| 176 | - $ce[] = "The referenced column name '" . $joinColumn['referencedColumnName'] . "' " . |
|
| 175 | + if ( ! in_array($joinColumn['referencedColumnName'], $identifierColumns)) { |
|
| 176 | + $ce[] = "The referenced column name '".$joinColumn['referencedColumnName']."' ". |
|
| 177 | 177 | "has to be a primary key column on the target entity class '".$class->name."'."; |
| 178 | 178 | break; |
| 179 | 179 | } |
@@ -181,32 +181,32 @@ discard block |
||
| 181 | 181 | |
| 182 | 182 | $identifierColumns = $targetMetadata->getIdentifierColumnNames(); |
| 183 | 183 | foreach ($assoc['joinTable']['inverseJoinColumns'] as $inverseJoinColumn) { |
| 184 | - if (! in_array($inverseJoinColumn['referencedColumnName'], $identifierColumns)) { |
|
| 185 | - $ce[] = "The referenced column name '" . $inverseJoinColumn['referencedColumnName'] . "' " . |
|
| 186 | - "has to be a primary key column on the target entity class '" .$targetMetadata->name . "'."; |
|
| 184 | + if ( ! in_array($inverseJoinColumn['referencedColumnName'], $identifierColumns)) { |
|
| 185 | + $ce[] = "The referenced column name '".$inverseJoinColumn['referencedColumnName']."' ". |
|
| 186 | + "has to be a primary key column on the target entity class '".$targetMetadata->name."'."; |
|
| 187 | 187 | break; |
| 188 | 188 | } |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | if (count($targetMetadata->getIdentifierColumnNames()) != count($assoc['joinTable']['inverseJoinColumns'])) { |
| 192 | - $ce[] = "The inverse join columns of the many-to-many table '" . $assoc['joinTable']['name'] . "' " . |
|
| 193 | - "have to contain to ALL identifier columns of the target entity '". $targetMetadata->name . "', " . |
|
| 194 | - "however '" . implode(", ", array_diff($targetMetadata->getIdentifierColumnNames(), array_values($assoc['relationToTargetKeyColumns']))) . |
|
| 192 | + $ce[] = "The inverse join columns of the many-to-many table '".$assoc['joinTable']['name']."' ". |
|
| 193 | + "have to contain to ALL identifier columns of the target entity '".$targetMetadata->name."', ". |
|
| 194 | + "however '".implode(", ", array_diff($targetMetadata->getIdentifierColumnNames(), array_values($assoc['relationToTargetKeyColumns']))). |
|
| 195 | 195 | "' are missing."; |
| 196 | 196 | } |
| 197 | 197 | |
| 198 | 198 | if (count($class->getIdentifierColumnNames()) != count($assoc['joinTable']['joinColumns'])) { |
| 199 | - $ce[] = "The join columns of the many-to-many table '" . $assoc['joinTable']['name'] . "' " . |
|
| 200 | - "have to contain to ALL identifier columns of the source entity '". $class->name . "', " . |
|
| 201 | - "however '" . implode(", ", array_diff($class->getIdentifierColumnNames(), array_values($assoc['relationToSourceKeyColumns']))) . |
|
| 199 | + $ce[] = "The join columns of the many-to-many table '".$assoc['joinTable']['name']."' ". |
|
| 200 | + "have to contain to ALL identifier columns of the source entity '".$class->name."', ". |
|
| 201 | + "however '".implode(", ", array_diff($class->getIdentifierColumnNames(), array_values($assoc['relationToSourceKeyColumns']))). |
|
| 202 | 202 | "' are missing."; |
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | } elseif ($assoc['type'] & ClassMetadataInfo::TO_ONE) { |
| 206 | 206 | $identifierColumns = $targetMetadata->getIdentifierColumnNames(); |
| 207 | 207 | foreach ($assoc['joinColumns'] as $joinColumn) { |
| 208 | - if (!in_array($joinColumn['referencedColumnName'], $identifierColumns)) { |
|
| 209 | - $ce[] = "The referenced column name '" . $joinColumn['referencedColumnName'] . "' " . |
|
| 208 | + if ( ! in_array($joinColumn['referencedColumnName'], $identifierColumns)) { |
|
| 209 | + $ce[] = "The referenced column name '".$joinColumn['referencedColumnName']."' ". |
|
| 210 | 210 | "has to be a primary key column on the target entity class '".$targetMetadata->name."'."; |
| 211 | 211 | } |
| 212 | 212 | } |
@@ -218,9 +218,9 @@ discard block |
||
| 218 | 218 | $ids[] = $joinColumn['name']; |
| 219 | 219 | } |
| 220 | 220 | |
| 221 | - $ce[] = "The join columns of the association '" . $assoc['fieldName'] . "' " . |
|
| 222 | - "have to match to ALL identifier columns of the target entity '". $targetMetadata->name . "', " . |
|
| 223 | - "however '" . implode(", ", array_diff($targetMetadata->getIdentifierColumnNames(), $ids)) . |
|
| 221 | + $ce[] = "The join columns of the association '".$assoc['fieldName']."' ". |
|
| 222 | + "have to match to ALL identifier columns of the target entity '".$targetMetadata->name."', ". |
|
| 223 | + "however '".implode(", ", array_diff($targetMetadata->getIdentifierColumnNames(), $ids)). |
|
| 224 | 224 | "' are missing."; |
| 225 | 225 | } |
| 226 | 226 | } |
@@ -228,19 +228,19 @@ discard block |
||
| 228 | 228 | |
| 229 | 229 | if (isset($assoc['orderBy']) && $assoc['orderBy'] !== null) { |
| 230 | 230 | foreach ($assoc['orderBy'] as $orderField => $orientation) { |
| 231 | - if (!$targetMetadata->hasField($orderField) && !$targetMetadata->hasAssociation($orderField)) { |
|
| 232 | - $ce[] = "The association " . $class->name."#".$fieldName." is ordered by a foreign field " . |
|
| 233 | - $orderField . " that is not a field on the target entity " . $targetMetadata->name . "."; |
|
| 231 | + if ( ! $targetMetadata->hasField($orderField) && ! $targetMetadata->hasAssociation($orderField)) { |
|
| 232 | + $ce[] = "The association ".$class->name."#".$fieldName." is ordered by a foreign field ". |
|
| 233 | + $orderField." that is not a field on the target entity ".$targetMetadata->name."."; |
|
| 234 | 234 | continue; |
| 235 | 235 | } |
| 236 | 236 | if ($targetMetadata->isCollectionValuedAssociation($orderField)) { |
| 237 | - $ce[] = "The association " . $class->name."#".$fieldName." is ordered by a field " . |
|
| 238 | - $orderField . " on " . $targetMetadata->name . " that is a collection-valued association."; |
|
| 237 | + $ce[] = "The association ".$class->name."#".$fieldName." is ordered by a field ". |
|
| 238 | + $orderField." on ".$targetMetadata->name." that is a collection-valued association."; |
|
| 239 | 239 | continue; |
| 240 | 240 | } |
| 241 | 241 | if ($targetMetadata->isAssociationInverseSide($orderField)) { |
| 242 | - $ce[] = "The association " . $class->name."#".$fieldName." is ordered by a field " . |
|
| 243 | - $orderField . " on " . $targetMetadata->name . " that is the inverse side of an association."; |
|
| 242 | + $ce[] = "The association ".$class->name."#".$fieldName." is ordered by a field ". |
|
| 243 | + $orderField." on ".$targetMetadata->name." that is the inverse side of an association."; |
|
| 244 | 244 | continue; |
| 245 | 245 | } |
| 246 | 246 | } |
@@ -248,9 +248,9 @@ discard block |
||
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | foreach ($class->subClasses as $subClass) { |
| 251 | - if (!in_array($class->name, class_parents($subClass))) { |
|
| 252 | - $ce[] = "According to the discriminator map class '" . $subClass . "' has to be a child ". |
|
| 253 | - "of '" . $class->name . "' but these entities are not related through inheritance."; |
|
| 251 | + if ( ! in_array($class->name, class_parents($subClass))) { |
|
| 252 | + $ce[] = "According to the discriminator map class '".$subClass."' has to be a child ". |
|
| 253 | + "of '".$class->name."' but these entities are not related through inheritance."; |
|
| 254 | 254 | } |
| 255 | 255 | } |
| 256 | 256 | |
@@ -50,11 +50,11 @@ discard block |
||
| 50 | 50 | $this->_em->clear(); |
| 51 | 51 | |
| 52 | 52 | $persistedManager = $this->_em->getRepository(GH6937Person::class) |
| 53 | - ->createQueryBuilder('e') |
|
| 54 | - ->where('e.id = :id') |
|
| 55 | - ->setParameter('id', $manager->id) |
|
| 56 | - ->getQuery() |
|
| 57 | - ->getOneOrNullResult(AbstractQuery::HYDRATE_SIMPLEOBJECT); |
|
| 53 | + ->createQueryBuilder('e') |
|
| 54 | + ->where('e.id = :id') |
|
| 55 | + ->setParameter('id', $manager->id) |
|
| 56 | + ->getQuery() |
|
| 57 | + ->getOneOrNullResult(AbstractQuery::HYDRATE_SIMPLEOBJECT); |
|
| 58 | 58 | |
| 59 | 59 | self::assertSame('Kevin', $persistedManager->name); |
| 60 | 60 | self::assertSame('555-5555', $persistedManager->phoneNumber); |
@@ -73,11 +73,11 @@ discard block |
||
| 73 | 73 | $this->_em->clear(); |
| 74 | 74 | |
| 75 | 75 | $persistedManager = $this->_em->getRepository(GH6937Person::class) |
| 76 | - ->createQueryBuilder('e') |
|
| 77 | - ->where('e.id = :id') |
|
| 78 | - ->setParameter('id', $manager->id) |
|
| 79 | - ->getQuery() |
|
| 80 | - ->getOneOrNullResult(); |
|
| 76 | + ->createQueryBuilder('e') |
|
| 77 | + ->where('e.id = :id') |
|
| 78 | + ->setParameter('id', $manager->id) |
|
| 79 | + ->getQuery() |
|
| 80 | + ->getOneOrNullResult(); |
|
| 81 | 81 | |
| 82 | 82 | self::assertSame('Kevin', $persistedManager->name); |
| 83 | 83 | self::assertSame('555-5555', $persistedManager->phoneNumber); |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | : $value; |
| 317 | 317 | |
| 318 | 318 | if ($cacheKeyInfo['isIdentifier'] && $value !== null) { |
| 319 | - $id[$dqlAlias] .= '|' . $value; |
|
| 319 | + $id[$dqlAlias] .= '|'.$value; |
|
| 320 | 320 | $nonemptyComponents[$dqlAlias] = true; |
| 321 | 321 | } |
| 322 | 322 | break; |
@@ -354,7 +354,7 @@ discard block |
||
| 354 | 354 | if ( ! isset($cacheKeyInfo['isScalar'])) { |
| 355 | 355 | $dqlAlias = $cacheKeyInfo['dqlAlias']; |
| 356 | 356 | $type = $cacheKeyInfo['type']; |
| 357 | - $fieldName = $dqlAlias . '_' . $fieldName; |
|
| 357 | + $fieldName = $dqlAlias.'_'.$fieldName; |
|
| 358 | 358 | $value = $type |
| 359 | 359 | ? $type->convertToPHPValue($value, $this->_platform) |
| 360 | 360 | : $value; |
@@ -460,7 +460,7 @@ discard block |
||
| 460 | 460 | private function getDiscriminatorValues(ClassMetadata $classMetadata) : array |
| 461 | 461 | { |
| 462 | 462 | $values = array_map( |
| 463 | - function (string $subClass) : string { |
|
| 463 | + function(string $subClass) : string { |
|
| 464 | 464 | return (string) $this->getClassMetadata($subClass)->discriminatorValue; |
| 465 | 465 | }, |
| 466 | 466 | $classMetadata->subClasses |
@@ -499,7 +499,7 @@ discard block |
||
| 499 | 499 | $state = $this->getEntityState($entity); |
| 500 | 500 | |
| 501 | 501 | if ($state !== self::STATE_MANAGED && $state !== self::STATE_REMOVED) { |
| 502 | - throw new \InvalidArgumentException("Entity has to be managed or scheduled for removal for single computation " . self::objToStr($entity)); |
|
| 502 | + throw new \InvalidArgumentException("Entity has to be managed or scheduled for removal for single computation ".self::objToStr($entity)); |
|
| 503 | 503 | } |
| 504 | 504 | |
| 505 | 505 | $class = $this->em->getClassMetadata(get_class($entity)); |
@@ -555,7 +555,7 @@ discard block |
||
| 555 | 555 | $oid = spl_object_hash($entity); |
| 556 | 556 | $data = []; |
| 557 | 557 | |
| 558 | - if (!isset($this->entityChangeSets[$oid])) { |
|
| 558 | + if ( ! isset($this->entityChangeSets[$oid])) { |
|
| 559 | 559 | return $data; |
| 560 | 560 | } |
| 561 | 561 | |
@@ -718,7 +718,7 @@ discard block |
||
| 718 | 718 | if ($owner === null) { // cloned |
| 719 | 719 | $actualValue->setOwner($entity, $assoc); |
| 720 | 720 | } else if ($owner !== $entity) { // no clone, we have to fix |
| 721 | - if (!$actualValue->isInitialized()) { |
|
| 721 | + if ( ! $actualValue->isInitialized()) { |
|
| 722 | 722 | $actualValue->initialize(); // we have to do this otherwise the cols share state |
| 723 | 723 | } |
| 724 | 724 | $newValue = clone $actualValue; |
@@ -864,7 +864,7 @@ discard block |
||
| 864 | 864 | $targetClass = $this->em->getClassMetadata($assoc['targetEntity']); |
| 865 | 865 | |
| 866 | 866 | foreach ($unwrappedValue as $key => $entry) { |
| 867 | - if (! ($entry instanceof $targetClass->name)) { |
|
| 867 | + if ( ! ($entry instanceof $targetClass->name)) { |
|
| 868 | 868 | throw ORMInvalidArgumentException::invalidAssociation($targetClass, $assoc, $entry); |
| 869 | 869 | } |
| 870 | 870 | |
@@ -942,7 +942,7 @@ discard block |
||
| 942 | 942 | |
| 943 | 943 | // Some identifiers may be foreign keys to new entities. |
| 944 | 944 | // In this case, we don't have the value yet and should treat it as if we have a post-insert generator |
| 945 | - if (! $this->hasMissingIdsWhichAreForeignKeys($class, $idValue)) { |
|
| 945 | + if ( ! $this->hasMissingIdsWhichAreForeignKeys($class, $idValue)) { |
|
| 946 | 946 | $this->entityIdentifiers[$oid] = $idValue; |
| 947 | 947 | } |
| 948 | 948 | } |
@@ -1091,7 +1091,7 @@ discard block |
||
| 1091 | 1091 | } |
| 1092 | 1092 | } else { |
| 1093 | 1093 | foreach ($insertionsForClass as $oid => $entity) { |
| 1094 | - if (! isset($this->entityIdentifiers[$oid])) { |
|
| 1094 | + if ( ! isset($this->entityIdentifiers[$oid])) { |
|
| 1095 | 1095 | //entity was not added to identity map because some identifiers are foreign keys to new entities. |
| 1096 | 1096 | //add it now |
| 1097 | 1097 | $this->addToEntityIdentifiersAndEntityMap($class, $oid, $entity); |
@@ -1256,7 +1256,7 @@ discard block |
||
| 1256 | 1256 | |
| 1257 | 1257 | $joinColumns = reset($assoc['joinColumns']); |
| 1258 | 1258 | |
| 1259 | - $calc->addDependency($targetClass->name, $class->name, (int)empty($joinColumns['nullable'])); |
|
| 1259 | + $calc->addDependency($targetClass->name, $class->name, (int) empty($joinColumns['nullable'])); |
|
| 1260 | 1260 | |
| 1261 | 1261 | // If the target class has mapped subclasses, these share the same dependency. |
| 1262 | 1262 | if ( ! $targetClass->subClasses) { |
@@ -1779,7 +1779,7 @@ discard block |
||
| 1779 | 1779 | throw ORMInvalidArgumentException::detachedEntityCannot($entity, "persisted"); |
| 1780 | 1780 | |
| 1781 | 1781 | default: |
| 1782 | - throw new UnexpectedValueException("Unexpected entity state: $entityState." . self::objToStr($entity)); |
|
| 1782 | + throw new UnexpectedValueException("Unexpected entity state: $entityState.".self::objToStr($entity)); |
|
| 1783 | 1783 | } |
| 1784 | 1784 | |
| 1785 | 1785 | $this->cascadePersist($entity, $visited); |
@@ -1849,7 +1849,7 @@ discard block |
||
| 1849 | 1849 | case self::STATE_DETACHED: |
| 1850 | 1850 | throw ORMInvalidArgumentException::detachedEntityCannot($entity, "removed"); |
| 1851 | 1851 | default: |
| 1852 | - throw new UnexpectedValueException("Unexpected entity state: $entityState." . self::objToStr($entity)); |
|
| 1852 | + throw new UnexpectedValueException("Unexpected entity state: $entityState.".self::objToStr($entity)); |
|
| 1853 | 1853 | } |
| 1854 | 1854 | |
| 1855 | 1855 | } |
@@ -1988,7 +1988,7 @@ discard block |
||
| 1988 | 1988 | */ |
| 1989 | 1989 | private function ensureVersionMatch(ClassMetadata $class, $entity, $managedCopy) |
| 1990 | 1990 | { |
| 1991 | - if (! ($class->isVersioned && $this->isLoaded($managedCopy) && $this->isLoaded($entity))) { |
|
| 1991 | + if ( ! ($class->isVersioned && $this->isLoaded($managedCopy) && $this->isLoaded($entity))) { |
|
| 1992 | 1992 | return; |
| 1993 | 1993 | } |
| 1994 | 1994 | |
@@ -2013,7 +2013,7 @@ discard block |
||
| 2013 | 2013 | */ |
| 2014 | 2014 | private function isLoaded($entity) |
| 2015 | 2015 | { |
| 2016 | - return !($entity instanceof Proxy) || $entity->__isInitialized(); |
|
| 2016 | + return ! ($entity instanceof Proxy) || $entity->__isInitialized(); |
|
| 2017 | 2017 | } |
| 2018 | 2018 | |
| 2019 | 2019 | /** |
@@ -2171,7 +2171,7 @@ discard block |
||
| 2171 | 2171 | |
| 2172 | 2172 | $associationMappings = array_filter( |
| 2173 | 2173 | $class->associationMappings, |
| 2174 | - function ($assoc) { return $assoc['isCascadeRefresh']; } |
|
| 2174 | + function($assoc) { return $assoc['isCascadeRefresh']; } |
|
| 2175 | 2175 | ); |
| 2176 | 2176 | |
| 2177 | 2177 | foreach ($associationMappings as $assoc) { |
@@ -2214,7 +2214,7 @@ discard block |
||
| 2214 | 2214 | |
| 2215 | 2215 | $associationMappings = array_filter( |
| 2216 | 2216 | $class->associationMappings, |
| 2217 | - function ($assoc) { return $assoc['isCascadeDetach']; } |
|
| 2217 | + function($assoc) { return $assoc['isCascadeDetach']; } |
|
| 2218 | 2218 | ); |
| 2219 | 2219 | |
| 2220 | 2220 | foreach ($associationMappings as $assoc) { |
@@ -2258,7 +2258,7 @@ discard block |
||
| 2258 | 2258 | |
| 2259 | 2259 | $associationMappings = array_filter( |
| 2260 | 2260 | $class->associationMappings, |
| 2261 | - function ($assoc) { return $assoc['isCascadeMerge']; } |
|
| 2261 | + function($assoc) { return $assoc['isCascadeMerge']; } |
|
| 2262 | 2262 | ); |
| 2263 | 2263 | |
| 2264 | 2264 | foreach ($associationMappings as $assoc) { |
@@ -2297,7 +2297,7 @@ discard block |
||
| 2297 | 2297 | |
| 2298 | 2298 | $associationMappings = array_filter( |
| 2299 | 2299 | $class->associationMappings, |
| 2300 | - function ($assoc) { return $assoc['isCascadePersist']; } |
|
| 2300 | + function($assoc) { return $assoc['isCascadePersist']; } |
|
| 2301 | 2301 | ); |
| 2302 | 2302 | |
| 2303 | 2303 | foreach ($associationMappings as $assoc) { |
@@ -2326,7 +2326,7 @@ discard block |
||
| 2326 | 2326 | break; |
| 2327 | 2327 | |
| 2328 | 2328 | case ($relatedEntities !== null): |
| 2329 | - if (! $relatedEntities instanceof $assoc['targetEntity']) { |
|
| 2329 | + if ( ! $relatedEntities instanceof $assoc['targetEntity']) { |
|
| 2330 | 2330 | throw ORMInvalidArgumentException::invalidAssociation( |
| 2331 | 2331 | $this->em->getClassMetadata($assoc['targetEntity']), |
| 2332 | 2332 | $assoc, |
@@ -2357,13 +2357,13 @@ discard block |
||
| 2357 | 2357 | |
| 2358 | 2358 | $associationMappings = array_filter( |
| 2359 | 2359 | $class->associationMappings, |
| 2360 | - function ($assoc) { return $assoc['isCascadeRemove']; } |
|
| 2360 | + function($assoc) { return $assoc['isCascadeRemove']; } |
|
| 2361 | 2361 | ); |
| 2362 | 2362 | |
| 2363 | 2363 | $entitiesToCascade = []; |
| 2364 | 2364 | |
| 2365 | 2365 | foreach ($associationMappings as $assoc) { |
| 2366 | - if ($entity instanceof Proxy && !$entity->__isInitialized__) { |
|
| 2366 | + if ($entity instanceof Proxy && ! $entity->__isInitialized__) { |
|
| 2367 | 2367 | $entity->__load(); |
| 2368 | 2368 | } |
| 2369 | 2369 | |
@@ -2427,7 +2427,7 @@ discard block |
||
| 2427 | 2427 | return; |
| 2428 | 2428 | } |
| 2429 | 2429 | |
| 2430 | - if ($entity instanceof Proxy && !$entity->__isInitialized__) { |
|
| 2430 | + if ($entity instanceof Proxy && ! $entity->__isInitialized__) { |
|
| 2431 | 2431 | $entity->__load(); |
| 2432 | 2432 | } |
| 2433 | 2433 | |
@@ -2442,7 +2442,7 @@ discard block |
||
| 2442 | 2442 | case LockMode::NONE === $lockMode: |
| 2443 | 2443 | case LockMode::PESSIMISTIC_READ === $lockMode: |
| 2444 | 2444 | case LockMode::PESSIMISTIC_WRITE === $lockMode: |
| 2445 | - if (!$this->em->getConnection()->isTransactionActive()) { |
|
| 2445 | + if ( ! $this->em->getConnection()->isTransactionActive()) { |
|
| 2446 | 2446 | throw TransactionRequiredException::transactionRequired(); |
| 2447 | 2447 | } |
| 2448 | 2448 | |
@@ -2766,7 +2766,7 @@ discard block |
||
| 2766 | 2766 | // then we can append this entity for eager loading! |
| 2767 | 2767 | if ($hints['fetchMode'][$class->name][$field] == ClassMetadata::FETCH_EAGER && |
| 2768 | 2768 | isset($hints[self::HINT_DEFEREAGERLOAD]) && |
| 2769 | - !$targetClass->isIdentifierComposite && |
|
| 2769 | + ! $targetClass->isIdentifierComposite && |
|
| 2770 | 2770 | $newValue instanceof Proxy && |
| 2771 | 2771 | $newValue->__isInitialized__ === false) { |
| 2772 | 2772 | |
@@ -3131,7 +3131,7 @@ discard block |
||
| 3131 | 3131 | public function getCollectionPersister(array $association) |
| 3132 | 3132 | { |
| 3133 | 3133 | $role = isset($association['cache']) |
| 3134 | - ? $association['sourceEntity'] . '::' . $association['fieldName'] |
|
| 3134 | + ? $association['sourceEntity'].'::'.$association['fieldName'] |
|
| 3135 | 3135 | : $association['type']; |
| 3136 | 3136 | |
| 3137 | 3137 | if (isset($this->collectionPersisters[$role])) { |
@@ -3349,7 +3349,7 @@ discard block |
||
| 3349 | 3349 | */ |
| 3350 | 3350 | private function afterTransactionComplete() |
| 3351 | 3351 | { |
| 3352 | - $this->performCallbackOnCachedPersister(function (CachedPersister $persister) { |
|
| 3352 | + $this->performCallbackOnCachedPersister(function(CachedPersister $persister) { |
|
| 3353 | 3353 | $persister->afterTransactionComplete(); |
| 3354 | 3354 | }); |
| 3355 | 3355 | } |
@@ -3359,7 +3359,7 @@ discard block |
||
| 3359 | 3359 | */ |
| 3360 | 3360 | private function afterTransactionRolledBack() |
| 3361 | 3361 | { |
| 3362 | - $this->performCallbackOnCachedPersister(function (CachedPersister $persister) { |
|
| 3362 | + $this->performCallbackOnCachedPersister(function(CachedPersister $persister) { |
|
| 3363 | 3363 | $persister->afterTransactionRolledBack(); |
| 3364 | 3364 | }); |
| 3365 | 3365 | } |
@@ -3455,11 +3455,11 @@ discard block |
||
| 3455 | 3455 | */ |
| 3456 | 3456 | private function mergeEntityStateIntoManagedCopy($entity, $managedCopy) |
| 3457 | 3457 | { |
| 3458 | - if (! $this->isLoaded($entity)) { |
|
| 3458 | + if ( ! $this->isLoaded($entity)) { |
|
| 3459 | 3459 | return; |
| 3460 | 3460 | } |
| 3461 | 3461 | |
| 3462 | - if (! $this->isLoaded($managedCopy)) { |
|
| 3462 | + if ( ! $this->isLoaded($managedCopy)) { |
|
| 3463 | 3463 | $managedCopy->__load(); |
| 3464 | 3464 | } |
| 3465 | 3465 | |
@@ -3482,7 +3482,7 @@ discard block |
||
| 3482 | 3482 | if ($other === null) { |
| 3483 | 3483 | $prop->setValue($managedCopy, null); |
| 3484 | 3484 | } else { |
| 3485 | - if ($other instanceof Proxy && !$other->__isInitialized()) { |
|
| 3485 | + if ($other instanceof Proxy && ! $other->__isInitialized()) { |
|
| 3486 | 3486 | // do not merge fields marked lazy that have not been fetched. |
| 3487 | 3487 | continue; |
| 3488 | 3488 | } |
@@ -3569,7 +3569,7 @@ discard block |
||
| 3569 | 3569 | */ |
| 3570 | 3570 | private function clearIdentityMapForEntityName($entityName) |
| 3571 | 3571 | { |
| 3572 | - if (! isset($this->identityMap[$entityName])) { |
|
| 3572 | + if ( ! isset($this->identityMap[$entityName])) { |
|
| 3573 | 3573 | return; |
| 3574 | 3574 | } |
| 3575 | 3575 | |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | $this->_em->getClassMetadata(OwningSide::class), |
| 21 | 21 | $this->_em->getClassMetadata(InverseSide::class), |
| 22 | 22 | ]); |
| 23 | - } catch(ToolsException $e) { |
|
| 23 | + } catch (ToolsException $e) { |
|
| 24 | 24 | // ignored |
| 25 | 25 | } |
| 26 | 26 | } |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | { |
| 37 | 37 | $query = $this->_em->createQuery( |
| 38 | 38 | 'SELECT CONCAT(e.type, MIN(e.version)) pair' |
| 39 | - . ' FROM ' . GH7286Entity::class . ' e' |
|
| 39 | + . ' FROM '.GH7286Entity::class.' e' |
|
| 40 | 40 | . ' WHERE e.type IS NOT NULL' |
| 41 | 41 | . ' GROUP BY e.type' |
| 42 | 42 | . ' ORDER BY e.type' |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | |
| 61 | 61 | $query = $this->_em->createQuery( |
| 62 | 62 | 'SELECT CC(e.type, MIN(e.version)) pair' |
| 63 | - . ' FROM ' . GH7286Entity::class . ' e' |
|
| 63 | + . ' FROM '.GH7286Entity::class.' e' |
|
| 64 | 64 | . ' WHERE e.type IS NOT NULL AND e.type != :type' |
| 65 | 65 | . ' GROUP BY e.type' |
| 66 | 66 | ); |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | { |
| 21 | 21 | protected function _loadDriver() |
| 22 | 22 | { |
| 23 | - return new XmlDriver(__DIR__ . DIRECTORY_SEPARATOR . 'xml'); |
|
| 23 | + return new XmlDriver(__DIR__.DIRECTORY_SEPARATOR.'xml'); |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | public function testClassTableInheritanceDiscriminatorMap() |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | */ |
| 153 | 153 | public function testValidateXmlSchema($xmlMappingFile) |
| 154 | 154 | { |
| 155 | - $xsdSchemaFile = __DIR__ . '/../../../../../doctrine-mapping.xsd'; |
|
| 155 | + $xsdSchemaFile = __DIR__.'/../../../../../doctrine-mapping.xsd'; |
|
| 156 | 156 | $dom = new \DOMDocument(); |
| 157 | 157 | |
| 158 | 158 | $dom->load($xmlMappingFile); |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | |
| 163 | 163 | static public function dataValidSchema() |
| 164 | 164 | { |
| 165 | - $list = glob(__DIR__ . '/xml/*.xml'); |
|
| 165 | + $list = glob(__DIR__.'/xml/*.xml'); |
|
| 166 | 166 | $invalid = [ |
| 167 | 167 | 'Doctrine.Tests.Models.DDC889.DDC889Class.dcm' |
| 168 | 168 | ]; |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | return ! in_array(pathinfo($item, PATHINFO_FILENAME), $invalid); |
| 172 | 172 | }); |
| 173 | 173 | |
| 174 | - return array_map(function($item){ |
|
| 174 | + return array_map(function($item) { |
|
| 175 | 175 | return [$item]; |
| 176 | 176 | }, $list); |
| 177 | 177 | } |
@@ -225,8 +225,8 @@ discard block |
||
| 225 | 225 | */ |
| 226 | 226 | public function transactional($func) |
| 227 | 227 | { |
| 228 | - if (!is_callable($func)) { |
|
| 229 | - throw new \InvalidArgumentException('Expected argument of type "callable", got "' . gettype($func) . '"'); |
|
| 228 | + if ( ! is_callable($func)) { |
|
| 229 | + throw new \InvalidArgumentException('Expected argument of type "callable", got "'.gettype($func).'"'); |
|
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | $this->conn->beginTransaction(); |
@@ -762,7 +762,7 @@ discard block |
||
| 762 | 762 | */ |
| 763 | 763 | public function isOpen() |
| 764 | 764 | { |
| 765 | - return (!$this->closed); |
|
| 765 | + return ( ! $this->closed); |
|
| 766 | 766 | } |
| 767 | 767 | |
| 768 | 768 | /** |
@@ -873,7 +873,7 @@ discard block |
||
| 873 | 873 | sprintf( |
| 874 | 874 | 'Invalid $connection argument of type %s given%s.', |
| 875 | 875 | is_object($connection) ? get_class($connection) : gettype($connection), |
| 876 | - is_object($connection) ? '' : ': "' . $connection . '"' |
|
| 876 | + is_object($connection) ? '' : ': "'.$connection.'"' |
|
| 877 | 877 | ) |
| 878 | 878 | ); |
| 879 | 879 | } |
@@ -923,13 +923,13 @@ discard block |
||
| 923 | 923 | { |
| 924 | 924 | switch ($lockMode) { |
| 925 | 925 | case LockMode::OPTIMISTIC: |
| 926 | - if (!$class->isVersioned) { |
|
| 926 | + if ( ! $class->isVersioned) { |
|
| 927 | 927 | throw OptimisticLockException::notVersioned($class->name); |
| 928 | 928 | } |
| 929 | 929 | break; |
| 930 | 930 | case LockMode::PESSIMISTIC_READ: |
| 931 | 931 | case LockMode::PESSIMISTIC_WRITE: |
| 932 | - if (!$this->getConnection()->isTransactionActive()) { |
|
| 932 | + if ( ! $this->getConnection()->isTransactionActive()) { |
|
| 933 | 933 | throw TransactionRequiredException::transactionRequired(); |
| 934 | 934 | } |
| 935 | 935 | } |