@@ -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 | |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | |
96 | 96 | $resultSet = $query->execute([], constant($hydrationMode)); |
97 | 97 | |
98 | - $dumper = new CliDumper(static function (string $payload) use ($output) : void { |
|
98 | + $dumper = new CliDumper(static function(string $payload) use ($output) : void { |
|
99 | 99 | $output->write($payload); |
100 | 100 | }); |
101 | 101 | $dumper->dump((new VarCloner())->cloneVar($resultSet)); |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | { |
87 | 87 | $cache = self::createCacheInstance($isDevMode, $cache); |
88 | 88 | |
89 | - if (! $cache instanceof CacheProvider) { |
|
89 | + if ( ! $cache instanceof CacheProvider) { |
|
90 | 90 | return $cache; |
91 | 91 | } |
92 | 92 | |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | $namespace .= ':'; |
97 | 97 | } |
98 | 98 | |
99 | - $cache->setNamespace($namespace . 'dc2_' . md5($proxyDir) . '_'); // to avoid collisions |
|
99 | + $cache->setNamespace($namespace.'dc2_'.md5($proxyDir).'_'); // to avoid collisions |
|
100 | 100 | |
101 | 101 | return $cache; |
102 | 102 | } |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | |
36 | 36 | public function tearDown() : void |
37 | 37 | { |
38 | - if (! $this->originalIncludePath) { |
|
38 | + if ( ! $this->originalIncludePath) { |
|
39 | 39 | return; |
40 | 40 | } |
41 | 41 | |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | $config = Setup::createConfiguration(false, __DIR__); |
75 | 75 | $cache = $config->getMetadataCacheImpl(); |
76 | 76 | |
77 | - self::assertSame('dc2_' . md5(__DIR__) . '_', $cache->getNamespace()); |
|
77 | + self::assertSame('dc2_'.md5(__DIR__).'_', $cache->getNamespace()); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | /** |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | $config = Setup::createConfiguration(false, __DIR__, new ArrayCache()); |
86 | 86 | $cache = $config->getMetadataCacheImpl(); |
87 | 87 | |
88 | - self::assertSame('dc2_' . md5(__DIR__) . '_', $cache->getNamespace()); |
|
88 | + self::assertSame('dc2_'.md5(__DIR__).'_', $cache->getNamespace()); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | /** |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | $cache = $config->getMetadataCacheImpl(); |
101 | 101 | |
102 | 102 | self::assertSame($originalCache, $cache); |
103 | - self::assertSame('foo:dc2_' . md5(__DIR__) . '_', $cache->getNamespace()); |
|
103 | + self::assertSame('foo:dc2_'.md5(__DIR__).'_', $cache->getNamespace()); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | /** |
@@ -57,8 +57,8 @@ |
||
57 | 57 | $this->parsedQueryWithDeclaredParameterType = $entityManager->createQuery($dql); |
58 | 58 | |
59 | 59 | foreach (range(1, 10) as $index) { |
60 | - $this->parsedQueryWithInferredParameterType->setParameter('parameter' . $index, new DateTime()); |
|
61 | - $this->parsedQueryWithDeclaredParameterType->setParameter('parameter' . $index, new DateTime(), DateTimeType::DATETIME); |
|
60 | + $this->parsedQueryWithInferredParameterType->setParameter('parameter'.$index, new DateTime()); |
|
61 | + $this->parsedQueryWithDeclaredParameterType->setParameter('parameter'.$index, new DateTime(), DateTimeType::DATETIME); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | // Force parsing upfront - we don't benchmark that bit in this scenario |
@@ -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 |
@@ -116,7 +116,7 @@ |
||
116 | 116 | public function quote($input, $type = null) |
117 | 117 | { |
118 | 118 | if (is_string($input)) { |
119 | - return "'" . $input . "'"; |
|
119 | + return "'".$input."'"; |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | return $input; |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | |
37 | 37 | while ($worker->work()) { |
38 | 38 | if ($worker->returnCode() !== GEARMAN_SUCCESS) { |
39 | - echo 'return_code: ' . $worker->returnCode() . "\n"; |
|
39 | + echo 'return_code: '.$worker->returnCode()."\n"; |
|
40 | 40 | break; |
41 | 41 | } |
42 | 42 | } |
@@ -61,14 +61,14 @@ discard block |
||
61 | 61 | |
62 | 62 | public function findWithLock($job) |
63 | 63 | { |
64 | - return $this->process($job, static function ($fixture, $em) { |
|
64 | + return $this->process($job, static function($fixture, $em) { |
|
65 | 65 | $entity = $em->find($fixture['entityName'], $fixture['entityId'], $fixture['lockMode']); |
66 | 66 | }); |
67 | 67 | } |
68 | 68 | |
69 | 69 | public function dqlWithLock($job) |
70 | 70 | { |
71 | - return $this->process($job, static function ($fixture, $em) { |
|
71 | + return $this->process($job, static function($fixture, $em) { |
|
72 | 72 | /** @var Doctrine\ORM\Query $query */ |
73 | 73 | $query = $em->createQuery($fixture['dql']); |
74 | 74 | |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | |
81 | 81 | public function lock($job) |
82 | 82 | { |
83 | - return $this->process($job, static function ($fixture, $em) { |
|
83 | + return $this->process($job, static function($fixture, $em) { |
|
84 | 84 | $entity = $em->find($fixture['entityName'], $fixture['entityId']); |
85 | 85 | |
86 | 86 | $em->lock($entity, $fixture['lockMode']); |
@@ -89,18 +89,18 @@ discard block |
||
89 | 89 | |
90 | 90 | protected function processWorkload($job) |
91 | 91 | { |
92 | - echo 'Received job: ' . $job->handle() . ' for function ' . $job->functionName() . "\n"; |
|
92 | + echo 'Received job: '.$job->handle().' for function '.$job->functionName()."\n"; |
|
93 | 93 | |
94 | 94 | $workload = $job->workload(); |
95 | 95 | $workload = unserialize($workload); |
96 | 96 | |
97 | - if (! isset($workload['conn']) || ! is_array($workload['conn'])) { |
|
97 | + if ( ! isset($workload['conn']) || ! is_array($workload['conn'])) { |
|
98 | 98 | throw new InvalidArgumentException('Missing Database parameters'); |
99 | 99 | } |
100 | 100 | |
101 | 101 | $this->em = $this->createEntityManager($workload['conn']); |
102 | 102 | |
103 | - if (! isset($workload['fixture'])) { |
|
103 | + if ( ! isset($workload['fixture'])) { |
|
104 | 104 | throw new InvalidArgumentException('Missing Fixture parameters'); |
105 | 105 | } |
106 | 106 | |
@@ -110,11 +110,11 @@ discard block |
||
110 | 110 | protected function createEntityManager($conn) |
111 | 111 | { |
112 | 112 | $config = new Configuration(); |
113 | - $config->setProxyDir(__DIR__ . '/../../../Proxies'); |
|
113 | + $config->setProxyDir(__DIR__.'/../../../Proxies'); |
|
114 | 114 | $config->setProxyNamespace('MyProject\Proxies'); |
115 | 115 | $config->setAutoGenerateProxyClasses(true); |
116 | 116 | |
117 | - $annotDriver = $config->newDefaultAnnotationDriver([__DIR__ . '/../../../Models/']); |
|
117 | + $annotDriver = $config->newDefaultAnnotationDriver([__DIR__.'/../../../Models/']); |
|
118 | 118 | $config->setMetadataDriverImpl($annotDriver); |
119 | 119 | |
120 | 120 | $cache = new ArrayCache(); |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | $driver = new DatabaseDriver($sm); |
64 | 64 | |
65 | 65 | foreach ($driver->getAllClassNames() as $className) { |
66 | - if (! in_array(strtolower($className), $classNames, true)) { |
|
66 | + if ( ! in_array(strtolower($className), $classNames, true)) { |
|
67 | 67 | continue; |
68 | 68 | } |
69 | 69 | |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | } |
76 | 76 | |
77 | 77 | if (count($metadatas) !== count($classNames)) { |
78 | - $this->fail("Have not found all classes matching the names '" . implode(', ', $classNames) . "' only tables " . implode(', ', array_keys($metadatas))); |
|
78 | + $this->fail("Have not found all classes matching the names '".implode(', ', $classNames)."' only tables ".implode(', ', array_keys($metadatas))); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | return $metadatas; |
@@ -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 | } |