@@ -35,6 +35,6 @@ |
||
35 | 35 | |
36 | 36 | public function __toString() |
37 | 37 | { |
38 | - return self::class . '[id=' . $this->id . ']'; |
|
38 | + return self::class.'[id='.$this->id.']'; |
|
39 | 39 | } |
40 | 40 | } |
@@ -33,13 +33,13 @@ |
||
33 | 33 | protected function configure() |
34 | 34 | { |
35 | 35 | $this->setName('orm:run-dql') |
36 | - ->setDescription('Executes arbitrary DQL directly from the command line') |
|
37 | - ->addArgument('dql', InputArgument::REQUIRED, 'The DQL to execute.') |
|
38 | - ->addOption('hydrate', null, InputOption::VALUE_REQUIRED, 'Hydration mode of result set. Should be either: object, array, scalar or single-scalar.', 'object') |
|
39 | - ->addOption('first-result', null, InputOption::VALUE_REQUIRED, 'The first result in the result set.') |
|
40 | - ->addOption('max-result', null, InputOption::VALUE_REQUIRED, 'The maximum number of results in the result set.') |
|
41 | - ->addOption('show-sql', null, InputOption::VALUE_NONE, 'Dump generated SQL instead of executing query') |
|
42 | - ->setHelp('Executes arbitrary DQL directly from the command line.'); |
|
36 | + ->setDescription('Executes arbitrary DQL directly from the command line') |
|
37 | + ->addArgument('dql', InputArgument::REQUIRED, 'The DQL to execute.') |
|
38 | + ->addOption('hydrate', null, InputOption::VALUE_REQUIRED, 'Hydration mode of result set. Should be either: object, array, scalar or single-scalar.', 'object') |
|
39 | + ->addOption('first-result', null, InputOption::VALUE_REQUIRED, 'The first result in the result set.') |
|
40 | + ->addOption('max-result', null, InputOption::VALUE_REQUIRED, 'The maximum number of results in the result set.') |
|
41 | + ->addOption('show-sql', null, InputOption::VALUE_NONE, 'Dump generated SQL instead of executing query') |
|
42 | + ->setHelp('Executes arbitrary DQL directly from the command line.'); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | /** |
@@ -58,9 +58,9 @@ discard block |
||
58 | 58 | } |
59 | 59 | |
60 | 60 | $hydrationModeName = $input->getOption('hydrate'); |
61 | - $hydrationMode = 'Doctrine\ORM\Query::HYDRATE_' . \strtoupper(\str_replace('-', '_', $hydrationModeName)); |
|
61 | + $hydrationMode = 'Doctrine\ORM\Query::HYDRATE_'.\strtoupper(\str_replace('-', '_', $hydrationModeName)); |
|
62 | 62 | |
63 | - if (! \defined($hydrationMode)) { |
|
63 | + if ( ! \defined($hydrationMode)) { |
|
64 | 64 | throw new RuntimeException(\sprintf( |
65 | 65 | "Hydration mode '%s' does not exist. It should be either: object. array, scalar or single-scalar.", |
66 | 66 | $hydrationModeName |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | $firstResult = $input->getOption('first-result'); |
72 | 72 | |
73 | 73 | if ($firstResult !== null) { |
74 | - if (! \is_numeric($firstResult)) { |
|
74 | + if ( ! \is_numeric($firstResult)) { |
|
75 | 75 | throw new LogicException("Option 'first-result' must contain an integer value"); |
76 | 76 | } |
77 | 77 | |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | $maxResult = $input->getOption('max-result'); |
82 | 82 | |
83 | 83 | if ($maxResult !== null) { |
84 | - if (! \is_numeric($maxResult)) { |
|
84 | + if ( ! \is_numeric($maxResult)) { |
|
85 | 85 | throw new LogicException("Option 'max-result' must contain an integer value"); |
86 | 86 | } |
87 | 87 | |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | |
97 | 97 | $resultSet = $query->execute([], \constant($hydrationMode)); |
98 | 98 | |
99 | - $dumper = new CliDumper(static function (string $payload) use ($output) : void { |
|
99 | + $dumper = new CliDumper(static function(string $payload) use ($output) : void { |
|
100 | 100 | $output->write($payload); |
101 | 101 | }); |
102 | 102 | $dumper->dump((new VarCloner())->cloneVar($resultSet)); |
@@ -34,7 +34,7 @@ |
||
34 | 34 | */ |
35 | 35 | public function getDatabasePlatform() |
36 | 36 | { |
37 | - if (! $this->platformMock) { |
|
37 | + if ( ! $this->platformMock) { |
|
38 | 38 | $this->platformMock = new DatabasePlatformMock(); |
39 | 39 | } |
40 | 40 |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | { |
80 | 80 | if ($entityManager !== self::$entityManager) { |
81 | 81 | throw new RuntimeException( |
82 | - 'Trying to use PersistentObject with different EntityManager instances. ' . |
|
82 | + 'Trying to use PersistentObject with different EntityManager instances. '. |
|
83 | 83 | 'Was PersistentObject::setEntityManager() called?' |
84 | 84 | ); |
85 | 85 | } |
@@ -104,8 +104,8 @@ discard block |
||
104 | 104 | |
105 | 105 | $property = $this->cm->getProperty($field); |
106 | 106 | |
107 | - if (! $property) { |
|
108 | - throw new BadMethodCallException("no field with name '" . $field . "' exists on '" . $this->cm->getClassName() . "'"); |
|
107 | + if ( ! $property) { |
|
108 | + throw new BadMethodCallException("no field with name '".$field."' exists on '".$this->cm->getClassName()."'"); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | switch (true) { |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | $targetClassName = $property->getTargetEntity(); |
118 | 118 | |
119 | 119 | if ($args[0] !== null && ! ($args[0] instanceof $targetClassName)) { |
120 | - throw new InvalidArgumentException("Expected persistent object of type '" . $targetClassName . "'"); |
|
120 | + throw new InvalidArgumentException("Expected persistent object of type '".$targetClassName."'"); |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | $this->{$field} = $args[0]; |
@@ -143,8 +143,8 @@ discard block |
||
143 | 143 | |
144 | 144 | $property = $this->cm->getProperty($field); |
145 | 145 | |
146 | - if (! $property) { |
|
147 | - throw new BadMethodCallException("no field with name '" . $field . "' exists on '" . $this->cm->getClassName() . "'"); |
|
146 | + if ( ! $property) { |
|
147 | + throw new BadMethodCallException("no field with name '".$field."' exists on '".$this->cm->getClassName()."'"); |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | return $this->{$field}; |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | $mappedByField = $property->getMappedBy(); |
167 | 167 | $targetMetadata = self::$entityManager->getClassMetadata($property->getTargetEntity()); |
168 | 168 | $targetProperty = $targetMetadata->getProperty($mappedByField); |
169 | - $setterMethodName = ($targetProperty instanceof ToManyAssociationMetadata ? 'add' : 'set') . $mappedByField; |
|
169 | + $setterMethodName = ($targetProperty instanceof ToManyAssociationMetadata ? 'add' : 'set').$mappedByField; |
|
170 | 170 | |
171 | 171 | $targetObject->{$setterMethodName}($this); |
172 | 172 | } |
@@ -188,21 +188,21 @@ discard block |
||
188 | 188 | |
189 | 189 | $property = $this->cm->getProperty($field); |
190 | 190 | |
191 | - if (! $property) { |
|
192 | - throw new BadMethodCallException("no field with name '" . $field . "' exists on '" . $this->cm->getClassName() . "'"); |
|
191 | + if ( ! $property) { |
|
192 | + throw new BadMethodCallException("no field with name '".$field."' exists on '".$this->cm->getClassName()."'"); |
|
193 | 193 | } |
194 | 194 | |
195 | - if (! ($property instanceof ToManyAssociationMetadata)) { |
|
196 | - throw new BadMethodCallException('There is no method add' . $field . '() on ' . $this->cm->getClassName()); |
|
195 | + if ( ! ($property instanceof ToManyAssociationMetadata)) { |
|
196 | + throw new BadMethodCallException('There is no method add'.$field.'() on '.$this->cm->getClassName()); |
|
197 | 197 | } |
198 | 198 | |
199 | 199 | $targetClassName = $property->getTargetEntity(); |
200 | 200 | |
201 | - if (! ($args[0] instanceof $targetClassName)) { |
|
202 | - throw new InvalidArgumentException("Expected persistent object of type '" . $targetClassName . "'"); |
|
201 | + if ( ! ($args[0] instanceof $targetClassName)) { |
|
202 | + throw new InvalidArgumentException("Expected persistent object of type '".$targetClassName."'"); |
|
203 | 203 | } |
204 | 204 | |
205 | - if (! ($this->{$field} instanceof Collection)) { |
|
205 | + if ( ! ($this->{$field} instanceof Collection)) { |
|
206 | 206 | $this->{$field} = new ArrayCollection($this->{$field} ?: []); |
207 | 207 | } |
208 | 208 | |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | return; |
225 | 225 | } |
226 | 226 | |
227 | - if (! self::$entityManager) { |
|
227 | + if ( ! self::$entityManager) { |
|
228 | 228 | throw new RuntimeException('No runtime entity manager set. Call PersistentObject#setEntityManager().'); |
229 | 229 | } |
230 | 230 | |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | case 'add': |
255 | 255 | return $this->add($field, $args); |
256 | 256 | default: |
257 | - throw new BadMethodCallException('There is no method ' . $method . ' on ' . $this->cm->getClassName()); |
|
257 | + throw new BadMethodCallException('There is no method '.$method.' on '.$this->cm->getClassName()); |
|
258 | 258 | } |
259 | 259 | } |
260 | 260 | } |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | // association (table). Without initializing the collection. |
332 | 332 | $removed = parent::remove($key); |
333 | 333 | |
334 | - if (! $removed) { |
|
334 | + if ( ! $removed) { |
|
335 | 335 | return $removed; |
336 | 336 | } |
337 | 337 | |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | */ |
353 | 353 | public function removeElement($element) |
354 | 354 | { |
355 | - if (! $this->initialized && |
|
355 | + if ( ! $this->initialized && |
|
356 | 356 | $this->association !== null && |
357 | 357 | $this->association->getFetchMode() === FetchMode::EXTRA_LAZY) { |
358 | 358 | if ($this->collection->contains($element)) { |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | |
367 | 367 | $removed = parent::removeElement($element); |
368 | 368 | |
369 | - if (! $removed) { |
|
369 | + if ( ! $removed) { |
|
370 | 370 | return $removed; |
371 | 371 | } |
372 | 372 | |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | */ |
388 | 388 | public function containsKey($key) |
389 | 389 | { |
390 | - if (! $this->initialized && |
|
390 | + if ( ! $this->initialized && |
|
391 | 391 | $this->association !== null && |
392 | 392 | $this->association->getFetchMode() === FetchMode::EXTRA_LAZY && |
393 | 393 | $this->association->getIndexedBy()) { |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | */ |
405 | 405 | public function contains($element) |
406 | 406 | { |
407 | - if (! $this->initialized && |
|
407 | + if ( ! $this->initialized && |
|
408 | 408 | $this->association !== null && |
409 | 409 | $this->association->getFetchMode() === FetchMode::EXTRA_LAZY) { |
410 | 410 | $persister = $this->em->getUnitOfWork()->getCollectionPersister($this->association); |
@@ -420,11 +420,11 @@ discard block |
||
420 | 420 | */ |
421 | 421 | public function get($key) |
422 | 422 | { |
423 | - if (! $this->initialized && |
|
423 | + if ( ! $this->initialized && |
|
424 | 424 | $this->association !== null && |
425 | 425 | $this->association->getFetchMode() === FetchMode::EXTRA_LAZY && |
426 | 426 | $this->association->getIndexedBy()) { |
427 | - if (! $this->typeClass->isIdentifierComposite() && $this->typeClass->isIdentifier($this->association->getIndexedBy())) { |
|
427 | + if ( ! $this->typeClass->isIdentifierComposite() && $this->typeClass->isIdentifier($this->association->getIndexedBy())) { |
|
428 | 428 | return $this->em->find($this->typeClass->getClassName(), $key); |
429 | 429 | } |
430 | 430 | |
@@ -439,7 +439,7 @@ discard block |
||
439 | 439 | */ |
440 | 440 | public function count() |
441 | 441 | { |
442 | - if (! $this->initialized && |
|
442 | + if ( ! $this->initialized && |
|
443 | 443 | $this->association !== null && |
444 | 444 | $this->association->getFetchMode() === FetchMode::EXTRA_LAZY) { |
445 | 445 | $persister = $this->em->getUnitOfWork()->getCollectionPersister($this->association); |
@@ -503,7 +503,7 @@ discard block |
||
503 | 503 | */ |
504 | 504 | public function offsetSet($offset, $value) |
505 | 505 | { |
506 | - if (! isset($offset)) { |
|
506 | + if ( ! isset($offset)) { |
|
507 | 507 | $this->add($value); |
508 | 508 | |
509 | 509 | return; |
@@ -598,7 +598,7 @@ discard block |
||
598 | 598 | */ |
599 | 599 | public function slice($offset, $length = null) |
600 | 600 | { |
601 | - if (! $this->initialized && |
|
601 | + if ( ! $this->initialized && |
|
602 | 602 | ! $this->isDirty && |
603 | 603 | $this->association !== null && |
604 | 604 | $this->association->getFetchMode() === FetchMode::EXTRA_LAZY) { |
@@ -79,11 +79,11 @@ |
||
79 | 79 | |
80 | 80 | switch ($comparison->getOperator()) { |
81 | 81 | case Comparison::CONTAINS: |
82 | - return '%' . $value . '%'; |
|
82 | + return '%'.$value.'%'; |
|
83 | 83 | case Comparison::STARTS_WITH: |
84 | - return $value . '%'; |
|
84 | + return $value.'%'; |
|
85 | 85 | case Comparison::ENDS_WITH: |
86 | - return '%' . $value; |
|
86 | + return '%'.$value; |
|
87 | 87 | default: |
88 | 88 | return $value; |
89 | 89 | } |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | $classMetadata = $this->em->getClassMetadata($class); |
123 | 123 | $platform = $this->em->getConnection()->getDatabasePlatform(); |
124 | 124 | |
125 | - if (! $this->isInheritanceSupported($classMetadata)) { |
|
125 | + if ( ! $this->isInheritanceSupported($classMetadata)) { |
|
126 | 126 | throw new InvalidArgumentException( |
127 | 127 | 'ResultSetMapping builder does not currently support your inheritance scheme.' |
128 | 128 | ); |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | ); |
163 | 163 | } |
164 | 164 | |
165 | - if (! $joinColumn->getType()) { |
|
165 | + if ( ! $joinColumn->getType()) { |
|
166 | 166 | $joinColumn->setType(PersisterHelper::getTypeOfColumn($referencedColumnName, $targetClass, $this->em)); |
167 | 167 | } |
168 | 168 | |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | { |
202 | 202 | switch ($mode) { |
203 | 203 | case self::COLUMN_RENAMING_INCREMENT: |
204 | - return $columnName . $this->sqlCounter++; |
|
204 | + return $columnName.$this->sqlCounter++; |
|
205 | 205 | case self::COLUMN_RENAMING_CUSTOM: |
206 | 206 | return $customRenameColumns[$columnName] ?? $columnName; |
207 | 207 | case self::COLUMN_RENAMING_NONE: |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | $sql .= ', '; |
231 | 231 | } |
232 | 232 | |
233 | - $sql .= $tableAlias . '.'; |
|
233 | + $sql .= $tableAlias.'.'; |
|
234 | 234 | |
235 | 235 | if (isset($this->fieldMappings[$columnName])) { |
236 | 236 | $class = $this->em->getClassMetadata($this->declaringClasses[$columnName]); |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | $sql .= $this->discriminatorColumns[$dqlAlias]; |
243 | 243 | } |
244 | 244 | |
245 | - $sql .= ' AS ' . $columnName; |
|
245 | + $sql .= ' AS '.$columnName; |
|
246 | 246 | } |
247 | 247 | |
248 | 248 | return $sql; |
@@ -160,7 +160,7 @@ |
||
160 | 160 | ?ClassMetadata $parent, |
161 | 161 | ClassMetadataBuildingContext $metadataBuildingContext |
162 | 162 | ) : ClassMetadataDefinition { |
163 | - if (! isset($this->definitions[$className])) { |
|
163 | + if ( ! isset($this->definitions[$className])) { |
|
164 | 164 | $this->definitions[$className] = $this->definitionFactory->build($className, $parent, $metadataBuildingContext); |
165 | 165 | } |
166 | 166 |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | ?string $className = null, |
81 | 81 | ?string $embeddedClassName = null |
82 | 82 | ) : string { |
83 | - return $this->underscore($propertyName) . '_' . $embeddedColumnName; |
|
83 | + return $this->underscore($propertyName).'_'.$embeddedColumnName; |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | /** |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | */ |
97 | 97 | public function joinColumnName(string $propertyName, ?string $className = null) : string |
98 | 98 | { |
99 | - return $this->underscore($propertyName) . '_' . $this->referenceColumnName(); |
|
99 | + return $this->underscore($propertyName).'_'.$this->referenceColumnName(); |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | /** |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | */ |
105 | 105 | public function joinTableName(string $sourceEntity, string $targetEntity, ?string $propertyName = null) : string |
106 | 106 | { |
107 | - return $this->classToTableName($sourceEntity) . '_' . $this->classToTableName($targetEntity); |
|
107 | + return $this->classToTableName($sourceEntity).'_'.$this->classToTableName($targetEntity); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | /** |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | */ |
113 | 113 | public function joinKeyColumnName(string $entityName, ?string $referencedColumnName = null) : string |
114 | 114 | { |
115 | - return $this->classToTableName($entityName) . '_' . |
|
115 | + return $this->classToTableName($entityName).'_'. |
|
116 | 116 | ($referencedColumnName ?: $this->referenceColumnName()); |
117 | 117 | } |
118 | 118 |