@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | $metadata = $this->em->getClassMetadata($className); |
| 56 | 56 | $persister = $this->uow->getEntityPersister($metadata->getRootClassName()); |
| 57 | 57 | |
| 58 | - if (! ($persister instanceof CachedPersister)) { |
|
| 58 | + if ( ! ($persister instanceof CachedPersister)) { |
|
| 59 | 59 | return null; |
| 60 | 60 | } |
| 61 | 61 | |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | $metadata = $this->em->getClassMetadata($className); |
| 71 | 71 | $persister = $this->uow->getCollectionPersister($metadata->getProperty($association)); |
| 72 | 72 | |
| 73 | - if (! ($persister instanceof CachedPersister)) { |
|
| 73 | + if ( ! ($persister instanceof CachedPersister)) { |
|
| 74 | 74 | return null; |
| 75 | 75 | } |
| 76 | 76 | |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | $metadata = $this->em->getClassMetadata($className); |
| 86 | 86 | $persister = $this->uow->getEntityPersister($metadata->getRootClassName()); |
| 87 | 87 | |
| 88 | - if (! ($persister instanceof CachedPersister)) { |
|
| 88 | + if ( ! ($persister instanceof CachedPersister)) { |
|
| 89 | 89 | return false; |
| 90 | 90 | } |
| 91 | 91 | |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | $metadata = $this->em->getClassMetadata($className); |
| 101 | 101 | $persister = $this->uow->getEntityPersister($metadata->getRootClassName()); |
| 102 | 102 | |
| 103 | - if (! ($persister instanceof CachedPersister)) { |
|
| 103 | + if ( ! ($persister instanceof CachedPersister)) { |
|
| 104 | 104 | return; |
| 105 | 105 | } |
| 106 | 106 | |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | $metadata = $this->em->getClassMetadata($className); |
| 116 | 116 | $persister = $this->uow->getEntityPersister($metadata->getRootClassName()); |
| 117 | 117 | |
| 118 | - if (! ($persister instanceof CachedPersister)) { |
|
| 118 | + if ( ! ($persister instanceof CachedPersister)) { |
|
| 119 | 119 | return; |
| 120 | 120 | } |
| 121 | 121 | |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | foreach ($metadatas as $metadata) { |
| 133 | 133 | $persister = $this->uow->getEntityPersister($metadata->getRootClassName()); |
| 134 | 134 | |
| 135 | - if (! ($persister instanceof CachedPersister)) { |
|
| 135 | + if ( ! ($persister instanceof CachedPersister)) { |
|
| 136 | 136 | continue; |
| 137 | 137 | } |
| 138 | 138 | |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | $metadata = $this->em->getClassMetadata($className); |
| 149 | 149 | $persister = $this->uow->getCollectionPersister($metadata->getProperty($association)); |
| 150 | 150 | |
| 151 | - if (! ($persister instanceof CachedPersister)) { |
|
| 151 | + if ( ! ($persister instanceof CachedPersister)) { |
|
| 152 | 152 | return false; |
| 153 | 153 | } |
| 154 | 154 | |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | $metadata = $this->em->getClassMetadata($className); |
| 164 | 164 | $persister = $this->uow->getCollectionPersister($metadata->getProperty($association)); |
| 165 | 165 | |
| 166 | - if (! ($persister instanceof CachedPersister)) { |
|
| 166 | + if ( ! ($persister instanceof CachedPersister)) { |
|
| 167 | 167 | return; |
| 168 | 168 | } |
| 169 | 169 | |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | $metadata = $this->em->getClassMetadata($className); |
| 179 | 179 | $persister = $this->uow->getCollectionPersister($metadata->getProperty($association)); |
| 180 | 180 | |
| 181 | - if (! ($persister instanceof CachedPersister)) { |
|
| 181 | + if ( ! ($persister instanceof CachedPersister)) { |
|
| 182 | 182 | return; |
| 183 | 183 | } |
| 184 | 184 | |
@@ -194,13 +194,13 @@ discard block |
||
| 194 | 194 | |
| 195 | 195 | foreach ($metadatas as $metadata) { |
| 196 | 196 | foreach ($metadata->getDeclaredPropertiesIterator() as $association) { |
| 197 | - if (! $association instanceof ToManyAssociationMetadata) { |
|
| 197 | + if ( ! $association instanceof ToManyAssociationMetadata) { |
|
| 198 | 198 | continue; |
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | $persister = $this->uow->getCollectionPersister($association); |
| 202 | 202 | |
| 203 | - if (! ($persister instanceof CachedPersister)) { |
|
| 203 | + if ( ! ($persister instanceof CachedPersister)) { |
|
| 204 | 204 | continue; |
| 205 | 205 | } |
| 206 | 206 | |
@@ -251,11 +251,10 @@ discard block |
||
| 251 | 251 | public function getQueryCache($regionName = null) |
| 252 | 252 | { |
| 253 | 253 | if ($regionName === null) { |
| 254 | - return $this->defaultQueryCache ?: |
|
| 255 | - $this->defaultQueryCache = $this->cacheFactory->buildQueryCache($this->em); |
|
| 254 | + return $this->defaultQueryCache ?: $this->defaultQueryCache = $this->cacheFactory->buildQueryCache($this->em); |
|
| 256 | 255 | } |
| 257 | 256 | |
| 258 | - if (! isset($this->queryCaches[$regionName])) { |
|
| 257 | + if ( ! isset($this->queryCaches[$regionName])) { |
|
| 259 | 258 | $this->queryCaches[$regionName] = $this->cacheFactory->buildQueryCache($this->em, $regionName); |
| 260 | 259 | } |
| 261 | 260 | |
@@ -270,7 +269,7 @@ discard block |
||
| 270 | 269 | */ |
| 271 | 270 | private function buildEntityCacheKey(ClassMetadata $metadata, $identifier) |
| 272 | 271 | { |
| 273 | - if (! is_array($identifier)) { |
|
| 272 | + if ( ! is_array($identifier)) { |
|
| 274 | 273 | $identifier = $this->toIdentifierArray($metadata, $identifier); |
| 275 | 274 | } |
| 276 | 275 | |
@@ -286,7 +285,7 @@ discard block |
||
| 286 | 285 | */ |
| 287 | 286 | private function buildCollectionCacheKey(ClassMetadata $metadata, $association, $ownerIdentifier) |
| 288 | 287 | { |
| 289 | - if (! is_array($ownerIdentifier)) { |
|
| 288 | + if ( ! is_array($ownerIdentifier)) { |
|
| 290 | 289 | $ownerIdentifier = $this->toIdentifierArray($metadata, $ownerIdentifier); |
| 291 | 290 | } |
| 292 | 291 | |
@@ -54,11 +54,11 @@ discard block |
||
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | foreach ($metadata->getDeclaredPropertiesIterator() as $name => $association) { |
| 57 | - if (! isset($data[$name]) || $association instanceof FieldMetadata) { |
|
| 57 | + if ( ! isset($data[$name]) || $association instanceof FieldMetadata) { |
|
| 58 | 58 | continue; |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | - if (! $association instanceof ToOneAssociationMetadata) { |
|
| 61 | + if ( ! $association instanceof ToOneAssociationMetadata) { |
|
| 62 | 62 | unset($data[$name]); |
| 63 | 63 | |
| 64 | 64 | continue; |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | $targetClassMetadata = $this->em->getClassMetadata($targetEntity); |
| 69 | 69 | $targetPersister = $this->uow->getEntityPersister($targetEntity); |
| 70 | 70 | |
| 71 | - if (! $association->getCache()) { |
|
| 71 | + if ( ! $association->getCache()) { |
|
| 72 | 72 | $owningAssociation = ! $association->isOwningSide() |
| 73 | 73 | ? $targetClassMetadata->getProperty($association->getMappedBy()) |
| 74 | 74 | : $association; |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | continue; |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | - if (! $association->isPrimaryKey()) { |
|
| 119 | + if ( ! $association->isPrimaryKey()) { |
|
| 120 | 120 | $targetClass = StaticClassNameConverter::getClass($data[$name]); |
| 121 | 121 | $targetId = $this->uow->getEntityIdentifier($data[$name]); |
| 122 | 122 | $data[$name] = new AssociationCacheEntry($targetClass, $targetId); |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | ($association instanceof OneToOneAssociationMetadata && ! $association->isOwningSide()) |
| 166 | 166 | ); |
| 167 | 167 | |
| 168 | - if (! $isEagerLoad) { |
|
| 168 | + if ( ! $isEagerLoad) { |
|
| 169 | 169 | $data[$name] = $this->em->getReference($assocClass, $assocId); |
| 170 | 170 | |
| 171 | 171 | continue; |
@@ -62,17 +62,17 @@ discard block |
||
| 62 | 62 | */ |
| 63 | 63 | public function get(QueryCacheKey $key, ResultSetMapping $rsm, array $hints = []) |
| 64 | 64 | { |
| 65 | - if (! ($key->cacheMode & Cache::MODE_GET)) { |
|
| 65 | + if ( ! ($key->cacheMode & Cache::MODE_GET)) { |
|
| 66 | 66 | return null; |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | $cacheEntry = $this->region->get($key); |
| 70 | 70 | |
| 71 | - if (! $cacheEntry instanceof QueryCacheEntry) { |
|
| 71 | + if ( ! $cacheEntry instanceof QueryCacheEntry) { |
|
| 72 | 72 | return null; |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | - if (! $this->validator->isValid($key, $cacheEntry)) { |
|
| 75 | + if ( ! $this->validator->isValid($key, $cacheEntry)) { |
|
| 76 | 76 | $this->region->evict($key); |
| 77 | 77 | |
| 78 | 78 | return null; |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | |
| 89 | 89 | $cm = $this->em->getClassMetadata($entityName); |
| 90 | 90 | |
| 91 | - $generateKeys = function (array $entry) use ($cm) : EntityCacheKey { |
|
| 91 | + $generateKeys = function(array $entry) use ($cm) : EntityCacheKey { |
|
| 92 | 92 | return new EntityCacheKey($cm->getRootClassName(), $entry['identifier']); |
| 93 | 93 | }; |
| 94 | 94 | |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | $this->cacheLogger->entityCacheHit($regionName, $cacheKeys->identifiers[$index]); |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | - if (! $hasRelation) { |
|
| 114 | + if ( ! $hasRelation) { |
|
| 115 | 115 | $result[$index] = $unitOfWork->createEntity( |
| 116 | 116 | $entityEntry->class, |
| 117 | 117 | $entityEntry->resolveAssociationEntries($this->em), |
@@ -156,11 +156,11 @@ discard block |
||
| 156 | 156 | continue; |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | - if (! isset($assoc['list']) || empty($assoc['list'])) { |
|
| 159 | + if ( ! isset($assoc['list']) || empty($assoc['list'])) { |
|
| 160 | 160 | continue; |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | - $generateKeys = function ($id) use ($assocMetadata) : EntityCacheKey { |
|
| 163 | + $generateKeys = function($id) use ($assocMetadata) : EntityCacheKey { |
|
| 164 | 164 | return new EntityCacheKey($assocMetadata->getRootClassName(), $id); |
| 165 | 165 | }; |
| 166 | 166 | |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | throw FeatureNotImplemented::multipleRootEntities(); |
| 239 | 239 | } |
| 240 | 240 | |
| 241 | - if (! $rsm->isSelect) { |
|
| 241 | + if ( ! $rsm->isSelect) { |
|
| 242 | 242 | throw FeatureNotImplemented::nonSelectStatements(); |
| 243 | 243 | } |
| 244 | 244 | |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | throw FeatureNotImplemented::partialEntities(); |
| 247 | 247 | } |
| 248 | 248 | |
| 249 | - if (! ($key->cacheMode & Cache::MODE_PUT)) { |
|
| 249 | + if ( ! ($key->cacheMode & Cache::MODE_PUT)) { |
|
| 250 | 250 | return false; |
| 251 | 251 | } |
| 252 | 252 | |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | $unitOfWork = $this->em->getUnitOfWork(); |
| 257 | 257 | $persister = $unitOfWork->getEntityPersister($entityName); |
| 258 | 258 | |
| 259 | - if (! ($persister instanceof CachedPersister)) { |
|
| 259 | + if ( ! ($persister instanceof CachedPersister)) { |
|
| 260 | 260 | throw NonCacheableEntity::fromEntity($entityName); |
| 261 | 261 | } |
| 262 | 262 | |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | |
| 269 | 269 | if (($key->cacheMode & Cache::MODE_REFRESH) || ! $region->contains($entityKey)) { |
| 270 | 270 | // Cancel put result if entity put fail |
| 271 | - if (! $persister->storeEntityCache($entity, $entityKey)) { |
|
| 271 | + if ( ! $persister->storeEntityCache($entity, $entityKey)) { |
|
| 272 | 272 | return false; |
| 273 | 273 | } |
| 274 | 274 | } |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | } |
| 303 | 303 | |
| 304 | 304 | // store single nested association |
| 305 | - if (! is_array($assocValue)) { |
|
| 305 | + if ( ! is_array($assocValue)) { |
|
| 306 | 306 | // Cancel put result if association put fail |
| 307 | 307 | if ($this->storeAssociationCache($key, $association, $assocValue) === null) { |
| 308 | 308 | return false; |
@@ -341,9 +341,9 @@ discard block |
||
| 341 | 341 | $assocIdentifier = $unitOfWork->getEntityIdentifier($assocValue); |
| 342 | 342 | $entityKey = new EntityCacheKey($assocMetadata->getRootClassName(), $assocIdentifier); |
| 343 | 343 | |
| 344 | - if ((! $assocValue instanceof GhostObjectInterface && ($key->cacheMode & Cache::MODE_REFRESH)) || ! $assocRegion->contains($entityKey)) { |
|
| 344 | + if (( ! $assocValue instanceof GhostObjectInterface && ($key->cacheMode & Cache::MODE_REFRESH)) || ! $assocRegion->contains($entityKey)) { |
|
| 345 | 345 | // Entity put fail |
| 346 | - if (! $assocPersister->storeEntityCache($assocValue, $entityKey)) { |
|
| 346 | + if ( ! $assocPersister->storeEntityCache($assocValue, $entityKey)) { |
|
| 347 | 347 | return null; |
| 348 | 348 | } |
| 349 | 349 | } |
@@ -363,7 +363,7 @@ discard block |
||
| 363 | 363 | |
| 364 | 364 | if (($key->cacheMode & Cache::MODE_REFRESH) || ! $assocRegion->contains($entityKey)) { |
| 365 | 365 | // Entity put fail |
| 366 | - if (! $assocPersister->storeEntityCache($assocItem, $entityKey)) { |
|
| 366 | + if ( ! $assocPersister->storeEntityCache($assocItem, $entityKey)) { |
|
| 367 | 367 | return null; |
| 368 | 368 | } |
| 369 | 369 | } |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | public function getClassShortName(string $className) : string |
| 29 | 29 | { |
| 30 | 30 | if (strpos($className, '\\') !== false) { |
| 31 | - $className = substr($className, strrpos($className, '\\')+1); |
|
| 31 | + $className = substr($className, strrpos($className, '\\') + 1); |
|
| 32 | 32 | } |
| 33 | 33 | return $className; |
| 34 | 34 | } |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | $namespace = ''; |
| 42 | 42 | |
| 43 | 43 | if (strpos($className, '\\') !== false) { |
| 44 | - $namespace = strrev(substr(strrev($className), strpos(strrev($className), '\\')+1)); |
|
| 44 | + $namespace = strrev(substr(strrev($className), strpos(strrev($className), '\\') + 1)); |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | return $namespace; |
@@ -18,7 +18,7 @@ |
||
| 18 | 18 | */ |
| 19 | 19 | public function getParentClasses(string $className) : array |
| 20 | 20 | { |
| 21 | - if (! class_exists($className)) { |
|
| 21 | + if ( ! class_exists($className)) { |
|
| 22 | 22 | throw MappingException::nonExistingClass($className); |
| 23 | 23 | } |
| 24 | 24 | |
@@ -26,7 +26,7 @@ |
||
| 26 | 26 | */ |
| 27 | 27 | public function getRepository(EntityManagerInterface $entityManager, $entityName) |
| 28 | 28 | { |
| 29 | - $repositoryHash = $entityManager->getClassMetadata($entityName)->getClassName() . spl_object_id($entityManager); |
|
| 29 | + $repositoryHash = $entityManager->getClassMetadata($entityName)->getClassName().spl_object_id($entityManager); |
|
| 30 | 30 | |
| 31 | 31 | return $this->repositoryList[$repositoryHash] |
| 32 | 32 | ?? $this->repositoryList[$repositoryHash] = $this->createRepository($entityManager, $entityName); |
@@ -14,13 +14,13 @@ |
||
| 14 | 14 | string $method |
| 15 | 15 | ) : self { |
| 16 | 16 | return new self( |
| 17 | - "Entity '" . $entityName . "' has no field '" . $fieldName . "'. " . |
|
| 18 | - "You can therefore not call '" . $method . "' on the entities' repository." |
|
| 17 | + "Entity '".$entityName."' has no field '".$fieldName."'. ". |
|
| 18 | + "You can therefore not call '".$method."' on the entities' repository." |
|
| 19 | 19 | ); |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | public static function onMissingParameter(string $methodName) : self |
| 23 | 23 | { |
| 24 | - return new self("You need to pass a parameter to '" . $methodName . "'"); |
|
| 24 | + return new self("You need to pass a parameter to '".$methodName."'"); |
|
| 25 | 25 | } |
| 26 | 26 | } |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | string $associationFieldName |
| 14 | 14 | ) : self { |
| 15 | 15 | return new self( |
| 16 | - "You cannot search for the association field '" . $entityName . '#' . $associationFieldName . "', " . |
|
| 16 | + "You cannot search for the association field '".$entityName.'#'.$associationFieldName."', ". |
|
| 17 | 17 | 'because it is the inverse side of an association. Find methods only work on owning side associations.' |
| 18 | 18 | ); |
| 19 | 19 | } |
@@ -82,8 +82,8 @@ |
||
| 82 | 82 | */ |
| 83 | 83 | final public function getParameter($name) |
| 84 | 84 | { |
| 85 | - if (! isset($this->parameters[$name])) { |
|
| 86 | - throw new \InvalidArgumentException("Parameter '" . $name . "' does not exist."); |
|
| 85 | + if ( ! isset($this->parameters[$name])) { |
|
| 86 | + throw new \InvalidArgumentException("Parameter '".$name."' does not exist."); |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | return $this->em->getConnection()->quote($this->parameters[$name]['value'], $this->parameters[$name]['type']); |