@@ -41,7 +41,7 @@ |
||
| 41 | 41 | */ |
| 42 | 42 | public function getRepository(EntityManagerInterface $entityManager, $entityName) |
| 43 | 43 | { |
| 44 | - $repositoryHash = $entityManager->getClassMetadata($entityName)->getName() . spl_object_hash($entityManager); |
|
| 44 | + $repositoryHash = $entityManager->getClassMetadata($entityName)->getName().spl_object_hash($entityManager); |
|
| 45 | 45 | |
| 46 | 46 | if (isset($this->repositoryList[$repositoryHash])) { |
| 47 | 47 | return $this->repositoryList[$repositoryHash]; |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | */ |
| 35 | 35 | static public function scheduleInsertForManagedEntity($entity) |
| 36 | 36 | { |
| 37 | - return new self("A managed+dirty entity " . self::objToStr($entity) . " can not be scheduled for insertion."); |
|
| 37 | + return new self("A managed+dirty entity ".self::objToStr($entity)." can not be scheduled for insertion."); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | /** |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | */ |
| 45 | 45 | static public function scheduleInsertForRemovedEntity($entity) |
| 46 | 46 | { |
| 47 | - return new self("Removed entity " . self::objToStr($entity) . " can not be scheduled for insertion."); |
|
| 47 | + return new self("Removed entity ".self::objToStr($entity)." can not be scheduled for insertion."); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | /** |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | */ |
| 55 | 55 | static public function scheduleInsertTwice($entity) |
| 56 | 56 | { |
| 57 | - return new self("Entity " . self::objToStr($entity) . " can not be scheduled for insertion twice."); |
|
| 57 | + return new self("Entity ".self::objToStr($entity)." can not be scheduled for insertion twice."); |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | /** |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | static public function entityWithoutIdentity($className, $entity) |
| 67 | 67 | { |
| 68 | 68 | return new self( |
| 69 | - "The given entity of type '" . $className . "' (".self::objToStr($entity).") has no identity/no " . |
|
| 69 | + "The given entity of type '".$className."' (".self::objToStr($entity).") has no identity/no ". |
|
| 70 | 70 | "id values set. It cannot be added to the identity map." |
| 71 | 71 | ); |
| 72 | 72 | } |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | */ |
| 79 | 79 | static public function readOnlyRequiresManagedEntity($entity) |
| 80 | 80 | { |
| 81 | - return new self("Only managed entities can be marked or checked as read only. But " . self::objToStr($entity) . " is not"); |
|
| 81 | + return new self("Only managed entities can be marked or checked as read only. But ".self::objToStr($entity)." is not"); |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | /** |
@@ -90,13 +90,13 @@ discard block |
||
| 90 | 90 | static public function newEntityFoundThroughRelationship(array $assoc, $entry) |
| 91 | 91 | { |
| 92 | 92 | return new self("A new entity was found through the relationship '" |
| 93 | - . $assoc['sourceEntity'] . "#" . $assoc['fieldName'] . "' that was not" |
|
| 94 | - . " configured to cascade persist operations for entity: " . self::objToStr($entry) . "." |
|
| 93 | + . $assoc['sourceEntity']."#".$assoc['fieldName']."' that was not" |
|
| 94 | + . " configured to cascade persist operations for entity: ".self::objToStr($entry)."." |
|
| 95 | 95 | . " To solve this issue: Either explicitly call EntityManager#persist()" |
| 96 | 96 | . " on this unknown entity or configure cascade persist " |
| 97 | 97 | . " this association in the mapping for example @ManyToOne(..,cascade={\"persist\"})." |
| 98 | - . (method_exists($entry, '__toString') ? "": " If you cannot find out which entity causes the problem" |
|
| 99 | - . " implement '" . $assoc['targetEntity'] . "#__toString()' to get a clue.")); |
|
| 98 | + . (method_exists($entry, '__toString') ? "" : " If you cannot find out which entity causes the problem" |
|
| 99 | + . " implement '".$assoc['targetEntity']."#__toString()' to get a clue.")); |
|
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | /** |
@@ -107,8 +107,8 @@ discard block |
||
| 107 | 107 | */ |
| 108 | 108 | static public function detachedEntityFoundThroughRelationship(array $assoc, $entry) |
| 109 | 109 | { |
| 110 | - return new self("A detached entity of type " . $assoc['targetEntity'] . " (" . self::objToStr($entry) . ") " |
|
| 111 | - . " was found through the relationship '" . $assoc['sourceEntity'] . "#" . $assoc['fieldName'] . "' " |
|
| 110 | + return new self("A detached entity of type ".$assoc['targetEntity']." (".self::objToStr($entry).") " |
|
| 111 | + . " was found through the relationship '".$assoc['sourceEntity']."#".$assoc['fieldName']."' " |
|
| 112 | 112 | . "during cascading a persist operation."); |
| 113 | 113 | } |
| 114 | 114 | |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | */ |
| 120 | 120 | static public function entityNotManaged($entity) |
| 121 | 121 | { |
| 122 | - return new self("Entity " . self::objToStr($entity) . " is not managed. An entity is managed if its fetched " . |
|
| 122 | + return new self("Entity ".self::objToStr($entity)." is not managed. An entity is managed if its fetched ". |
|
| 123 | 123 | "from the database or registered as new through EntityManager#persist"); |
| 124 | 124 | } |
| 125 | 125 | |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | */ |
| 132 | 132 | static public function entityHasNoIdentity($entity, $operation) |
| 133 | 133 | { |
| 134 | - return new self("Entity has no identity, therefore " . $operation ." cannot be performed. " . self::objToStr($entity)); |
|
| 134 | + return new self("Entity has no identity, therefore ".$operation." cannot be performed. ".self::objToStr($entity)); |
|
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | /** |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | */ |
| 143 | 143 | static public function entityIsRemoved($entity, $operation) |
| 144 | 144 | { |
| 145 | - return new self("Entity is removed, therefore " . $operation ." cannot be performed. " . self::objToStr($entity)); |
|
| 145 | + return new self("Entity is removed, therefore ".$operation." cannot be performed. ".self::objToStr($entity)); |
|
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | /** |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | */ |
| 154 | 154 | static public function detachedEntityCannot($entity, $operation) |
| 155 | 155 | { |
| 156 | - return new self("Detached entity " . self::objToStr($entity) . " cannot be " . $operation); |
|
| 156 | + return new self("Detached entity ".self::objToStr($entity)." cannot be ".$operation); |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | /** |
@@ -165,8 +165,8 @@ discard block |
||
| 165 | 165 | */ |
| 166 | 166 | public static function invalidObject($context, $given, $parameterIndex = 1) |
| 167 | 167 | { |
| 168 | - return new self($context . ' expects parameter ' . $parameterIndex . |
|
| 169 | - ' to be an entity object, '. gettype($given) . ' given.'); |
|
| 168 | + return new self($context.' expects parameter '.$parameterIndex. |
|
| 169 | + ' to be an entity object, '.gettype($given).' given.'); |
|
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | /** |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | */ |
| 175 | 175 | public static function invalidCompositeIdentifier() |
| 176 | 176 | { |
| 177 | - return new self("Binding an entity with a composite primary key to a query is not supported. " . |
|
| 177 | + return new self("Binding an entity with a composite primary key to a query is not supported. ". |
|
| 178 | 178 | "You should split the parameter into the explicit fields and bind them separately."); |
| 179 | 179 | } |
| 180 | 180 | |
@@ -40,12 +40,12 @@ |
||
| 40 | 40 | $ids = array(); |
| 41 | 41 | |
| 42 | 42 | foreach ($id as $key => $value) { |
| 43 | - $ids[] = $key . '(' . $value . ')'; |
|
| 43 | + $ids[] = $key.'('.$value.')'; |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | |
| 47 | 47 | return new self( |
| 48 | - 'Entity of type \'' . $className . '\'' . ($ids ? ' for IDs ' . implode(', ', $ids) : '') . ' was not found' |
|
| 48 | + 'Entity of type \''.$className.'\''.($ids ? ' for IDs '.implode(', ', $ids) : '').' was not found' |
|
| 49 | 49 | ); |
| 50 | 50 | } |
| 51 | 51 | } |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | $expectedLockVersion = ($expectedLockVersion instanceof \DateTime) ? $expectedLockVersion->getTimestamp() : $expectedLockVersion; |
| 77 | 77 | $actualLockVersion = ($actualLockVersion instanceof \DateTime) ? $actualLockVersion->getTimestamp() : $actualLockVersion; |
| 78 | 78 | |
| 79 | - return new self("The optimistic lock failed, version " . $expectedLockVersion . " was expected, but is actually ".$actualLockVersion, $entity); |
|
| 79 | + return new self("The optimistic lock failed, version ".$expectedLockVersion." was expected, but is actually ".$actualLockVersion, $entity); |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | /** |
@@ -86,6 +86,6 @@ discard block |
||
| 86 | 86 | */ |
| 87 | 87 | public static function notVersioned($entityName) |
| 88 | 88 | { |
| 89 | - return new self("Cannot obtain optimistic lock on unversioned entity " . $entityName, null); |
|
| 89 | + return new self("Cannot obtain optimistic lock on unversioned entity ".$entityName, null); |
|
| 90 | 90 | } |
| 91 | 91 | } |
@@ -55,7 +55,7 @@ |
||
| 55 | 55 | |
| 56 | 56 | $assoc = $class->associationMappings[$fieldName]; |
| 57 | 57 | |
| 58 | - if (! $assoc['isOwningSide']) { |
|
| 58 | + if ( ! $assoc['isOwningSide']) { |
|
| 59 | 59 | return self::getTypeOfField($assoc['mappedBy'], $em->getClassMetadata($assoc['targetEntity']), $em); |
| 60 | 60 | } |
| 61 | 61 | |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | { |
| 126 | 126 | $wakeupProxy = $classMetadata->getReflectionClass()->hasMethod('__wakeup'); |
| 127 | 127 | |
| 128 | - return function (BaseProxy $proxy) use ($entityPersister, $classMetadata, $wakeupProxy) { |
|
| 128 | + return function(BaseProxy $proxy) use ($entityPersister, $classMetadata, $wakeupProxy) { |
|
| 129 | 129 | $initializer = $proxy->__getInitializer(); |
| 130 | 130 | $cloner = $proxy->__getCloner(); |
| 131 | 131 | |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | */ |
| 178 | 178 | private function createCloner(ClassMetadata $classMetadata, EntityPersister $entityPersister) |
| 179 | 179 | { |
| 180 | - return function (BaseProxy $proxy) use ($entityPersister, $classMetadata) { |
|
| 180 | + return function(BaseProxy $proxy) use ($entityPersister, $classMetadata) { |
|
| 181 | 181 | if ($proxy->__isInitialized()) { |
| 182 | 182 | return; |
| 183 | 183 | } |
@@ -212,10 +212,10 @@ |
||
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | /** |
| 215 | - * Obtain the name of the second level query cache region in which query results will be stored |
|
| 216 | - * |
|
| 217 | - * @return string|null The cache region name; NULL indicates the default region. |
|
| 218 | - */ |
|
| 215 | + * Obtain the name of the second level query cache region in which query results will be stored |
|
| 216 | + * |
|
| 217 | + * @return string|null The cache region name; NULL indicates the default region. |
|
| 218 | + */ |
|
| 219 | 219 | public function getCacheRegion() |
| 220 | 220 | { |
| 221 | 221 | return $this->cacheRegion; |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | public function getParameter($key) |
| 325 | 325 | { |
| 326 | 326 | $filteredParameters = $this->parameters->filter( |
| 327 | - function ($parameter) use ($key) |
|
| 327 | + function($parameter) use ($key) |
|
| 328 | 328 | { |
| 329 | 329 | // Must not be identical because of string to integer conversion |
| 330 | 330 | return ($key == $parameter->getName()); |
@@ -373,7 +373,7 @@ discard block |
||
| 373 | 373 | public function setParameter($key, $value, $type = null) |
| 374 | 374 | { |
| 375 | 375 | $filteredParameters = $this->parameters->filter( |
| 376 | - function ($parameter) use ($key) |
|
| 376 | + function($parameter) use ($key) |
|
| 377 | 377 | { |
| 378 | 378 | // Must not be identical because of string to integer conversion |
| 379 | 379 | return ($key == $parameter->getName()); |
@@ -469,7 +469,7 @@ discard block |
||
| 469 | 469 | */ |
| 470 | 470 | private function translateNamespaces(Query\ResultSetMapping $rsm) |
| 471 | 471 | { |
| 472 | - $translate = function ($alias) { |
|
| 472 | + $translate = function($alias) { |
|
| 473 | 473 | return $this->_em->getClassMetadata($alias)->getName(); |
| 474 | 474 | }; |
| 475 | 475 | |
@@ -1114,6 +1114,6 @@ discard block |
||
| 1114 | 1114 | |
| 1115 | 1115 | ksort($hints); |
| 1116 | 1116 | |
| 1117 | - return sha1($query . '-' . serialize($params) . '-' . serialize($hints)); |
|
| 1117 | + return sha1($query.'-'.serialize($params).'-'.serialize($hints)); |
|
| 1118 | 1118 | } |
| 1119 | 1119 | } |
@@ -3,12 +3,10 @@ |
||
| 3 | 3 | namespace Doctrine\Tests\ORM\Cache\Persister\Entity; |
| 4 | 4 | |
| 5 | 5 | use Doctrine\Tests\OrmTestCase; |
| 6 | - |
|
| 7 | 6 | use Doctrine\ORM\Cache\Region; |
| 8 | 7 | use Doctrine\ORM\EntityManager; |
| 9 | 8 | use Doctrine\ORM\Mapping\ClassMetadata; |
| 10 | 9 | use Doctrine\ORM\Persisters\Entity\EntityPersister; |
| 11 | - |
|
| 12 | 10 | use Doctrine\Tests\Models\Cache\Country; |
| 13 | 11 | use Doctrine\Common\Collections\Criteria; |
| 14 | 12 | use Doctrine\Common\Collections\ArrayCollection; |
@@ -45,9 +45,9 @@ discard block |
||
| 45 | 45 | */ |
| 46 | 46 | private $uow; |
| 47 | 47 | |
| 48 | - /** |
|
| 49 | - * @var \Doctrine\ORM\Cache\CacheFactory |
|
| 50 | - */ |
|
| 48 | + /** |
|
| 49 | + * @var \Doctrine\ORM\Cache\CacheFactory |
|
| 50 | + */ |
|
| 51 | 51 | private $cacheFactory; |
| 52 | 52 | |
| 53 | 53 | /** |
@@ -289,12 +289,12 @@ discard block |
||
| 289 | 289 | return $this->queryCaches[$regionName]; |
| 290 | 290 | } |
| 291 | 291 | |
| 292 | - /** |
|
| 293 | - * @param \Doctrine\ORM\Mapping\ClassMetadata $metadata The entity metadata. |
|
| 294 | - * @param mixed $identifier The entity identifier. |
|
| 295 | - * |
|
| 296 | - * @return \Doctrine\ORM\Cache\EntityCacheKey |
|
| 297 | - */ |
|
| 292 | + /** |
|
| 293 | + * @param \Doctrine\ORM\Mapping\ClassMetadata $metadata The entity metadata. |
|
| 294 | + * @param mixed $identifier The entity identifier. |
|
| 295 | + * |
|
| 296 | + * @return \Doctrine\ORM\Cache\EntityCacheKey |
|
| 297 | + */ |
|
| 298 | 298 | private function buildEntityCacheKey(ClassMetadata $metadata, $identifier) |
| 299 | 299 | { |
| 300 | 300 | if ( ! is_array($identifier)) { |
@@ -278,8 +278,7 @@ discard block |
||
| 278 | 278 | public function getQueryCache($regionName = null) |
| 279 | 279 | { |
| 280 | 280 | if ($regionName === null) { |
| 281 | - return $this->defaultQueryCache ?: |
|
| 282 | - $this->defaultQueryCache = $this->cacheFactory->buildQueryCache($this->em); |
|
| 281 | + return $this->defaultQueryCache ?: $this->defaultQueryCache = $this->cacheFactory->buildQueryCache($this->em); |
|
| 283 | 282 | } |
| 284 | 283 | |
| 285 | 284 | if ( ! isset($this->queryCaches[$regionName])) { |
@@ -314,7 +313,7 @@ discard block |
||
| 314 | 313 | private function buildCollectionCacheKey(ClassMetadata $metadata, $association, $ownerIdentifier) |
| 315 | 314 | { |
| 316 | 315 | if ( ! is_array($ownerIdentifier)) { |
| 317 | - $ownerIdentifier = $this->toIdentifierArray($metadata, $ownerIdentifier);; |
|
| 316 | + $ownerIdentifier = $this->toIdentifierArray($metadata, $ownerIdentifier); ; |
|
| 318 | 317 | } |
| 319 | 318 | |
| 320 | 319 | return new CollectionCacheKey($metadata->rootEntityName, $association, $ownerIdentifier); |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | */ |
| 74 | 74 | public function getCacheLogger() |
| 75 | 75 | { |
| 76 | - return $this->cacheLogger; |
|
| 76 | + return $this->cacheLogger; |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | /** |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | $this->queryValidator = new TimestampQueryCacheValidator(); |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | - return $this->queryValidator; |
|
| 116 | + return $this->queryValidator; |
|
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | /** |