@@ -94,12 +94,12 @@ discard block |
||
94 | 94 | */ |
95 | 95 | public function findMappingFile($className) |
96 | 96 | { |
97 | - $fileName = str_replace('\\', '.', $className) . $this->fileExtension; |
|
97 | + $fileName = str_replace('\\', '.', $className).$this->fileExtension; |
|
98 | 98 | |
99 | 99 | // Check whether file exists |
100 | 100 | foreach ($this->paths as $path) { |
101 | - if (is_file($path . DIRECTORY_SEPARATOR . $fileName)) { |
|
102 | - return $path . DIRECTORY_SEPARATOR . $fileName; |
|
101 | + if (is_file($path.DIRECTORY_SEPARATOR.$fileName)) { |
|
102 | + return $path.DIRECTORY_SEPARATOR.$fileName; |
|
103 | 103 | } |
104 | 104 | } |
105 | 105 | |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | |
116 | 116 | if ($this->paths) { |
117 | 117 | foreach ($this->paths as $path) { |
118 | - if (! is_dir($path)) { |
|
118 | + if (!is_dir($path)) { |
|
119 | 119 | throw MappingException::fileMappingDriversRequireConfiguredDirectoryPath($path); |
120 | 120 | } |
121 | 121 | |
@@ -145,11 +145,11 @@ discard block |
||
145 | 145 | */ |
146 | 146 | public function fileExists($className) |
147 | 147 | { |
148 | - $fileName = str_replace('\\', '.', $className) . $this->fileExtension; |
|
148 | + $fileName = str_replace('\\', '.', $className).$this->fileExtension; |
|
149 | 149 | |
150 | 150 | // Check whether file exists |
151 | 151 | foreach ((array) $this->paths as $path) { |
152 | - if (is_file($path . DIRECTORY_SEPARATOR . $fileName)) { |
|
152 | + if (is_file($path.DIRECTORY_SEPARATOR.$fileName)) { |
|
153 | 153 | return true; |
154 | 154 | } |
155 | 155 | } |
@@ -124,11 +124,11 @@ discard block |
||
124 | 124 | */ |
125 | 125 | public function fileExists($className) |
126 | 126 | { |
127 | - $defaultFileName = str_replace('\\', $this->nsSeparator, $className) . $this->fileExtension; |
|
127 | + $defaultFileName = str_replace('\\', $this->nsSeparator, $className).$this->fileExtension; |
|
128 | 128 | foreach ($this->paths as $path) { |
129 | - if (! isset($this->prefixes[$path])) { |
|
129 | + if (!isset($this->prefixes[$path])) { |
|
130 | 130 | // global namespace class |
131 | - if (is_file($path . DIRECTORY_SEPARATOR . $defaultFileName)) { |
|
131 | + if (is_file($path.DIRECTORY_SEPARATOR.$defaultFileName)) { |
|
132 | 132 | return true; |
133 | 133 | } |
134 | 134 | |
@@ -137,11 +137,11 @@ discard block |
||
137 | 137 | |
138 | 138 | $prefix = $this->prefixes[$path]; |
139 | 139 | |
140 | - if (strpos($className, $prefix . '\\') !== 0) { |
|
140 | + if (strpos($className, $prefix.'\\') !== 0) { |
|
141 | 141 | continue; |
142 | 142 | } |
143 | 143 | |
144 | - $filename = $path . '/' . strtr(substr($className, strlen($prefix) + 1), '\\', $this->nsSeparator) . $this->fileExtension; |
|
144 | + $filename = $path.'/'.strtr(substr($className, strlen($prefix) + 1), '\\', $this->nsSeparator).$this->fileExtension; |
|
145 | 145 | if (is_file($filename)) { |
146 | 146 | return true; |
147 | 147 | } |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | |
160 | 160 | if ($this->paths) { |
161 | 161 | foreach ((array) $this->paths as $path) { |
162 | - if (! is_dir($path)) { |
|
162 | + if (!is_dir($path)) { |
|
163 | 163 | throw MappingException::fileMappingDriversRequireConfiguredDirectoryPath($path); |
164 | 164 | } |
165 | 165 | |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | '\\' |
185 | 185 | ); |
186 | 186 | |
187 | - $classes[] = $this->prefixes[$path] . str_replace(DIRECTORY_SEPARATOR, '\\', $nsSuffix) . '\\' . str_replace($this->nsSeparator, '\\', $fileName); |
|
187 | + $classes[] = $this->prefixes[$path].str_replace(DIRECTORY_SEPARATOR, '\\', $nsSuffix).'\\'.str_replace($this->nsSeparator, '\\', $fileName); |
|
188 | 188 | } else { |
189 | 189 | $classes[] = str_replace($this->nsSeparator, '\\', $fileName); |
190 | 190 | } |
@@ -200,11 +200,11 @@ discard block |
||
200 | 200 | */ |
201 | 201 | public function findMappingFile($className) |
202 | 202 | { |
203 | - $defaultFileName = str_replace('\\', $this->nsSeparator, $className) . $this->fileExtension; |
|
203 | + $defaultFileName = str_replace('\\', $this->nsSeparator, $className).$this->fileExtension; |
|
204 | 204 | foreach ($this->paths as $path) { |
205 | - if (! isset($this->prefixes[$path])) { |
|
206 | - if (is_file($path . DIRECTORY_SEPARATOR . $defaultFileName)) { |
|
207 | - return $path . DIRECTORY_SEPARATOR . $defaultFileName; |
|
205 | + if (!isset($this->prefixes[$path])) { |
|
206 | + if (is_file($path.DIRECTORY_SEPARATOR.$defaultFileName)) { |
|
207 | + return $path.DIRECTORY_SEPARATOR.$defaultFileName; |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | continue; |
@@ -212,16 +212,16 @@ discard block |
||
212 | 212 | |
213 | 213 | $prefix = $this->prefixes[$path]; |
214 | 214 | |
215 | - if (strpos($className, $prefix . '\\') !== 0) { |
|
215 | + if (strpos($className, $prefix.'\\') !== 0) { |
|
216 | 216 | continue; |
217 | 217 | } |
218 | 218 | |
219 | - $filename = $path . '/' . strtr(substr($className, strlen($prefix) + 1), '\\', $this->nsSeparator) . $this->fileExtension; |
|
219 | + $filename = $path.'/'.strtr(substr($className, strlen($prefix) + 1), '\\', $this->nsSeparator).$this->fileExtension; |
|
220 | 220 | if (is_file($filename)) { |
221 | 221 | return $filename; |
222 | 222 | } |
223 | 223 | } |
224 | 224 | |
225 | - throw MappingException::mappingFileNotFound($className, substr($className, strrpos($className, '\\') + 1) . $this->fileExtension); |
|
225 | + throw MappingException::mappingFileNotFound($className, substr($className, strrpos($className, '\\') + 1).$this->fileExtension); |
|
226 | 226 | } |
227 | 227 | } |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | { |
13 | 13 | public function testGetPaths() |
14 | 14 | { |
15 | - $path = __DIR__ . '/_files'; |
|
15 | + $path = __DIR__.'/_files'; |
|
16 | 16 | |
17 | 17 | $locator = new DefaultFileLocator([$path]); |
18 | 18 | self::assertSame([$path], $locator->getPaths()); |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | |
32 | 32 | public function testUniquePaths() |
33 | 33 | { |
34 | - $path = __DIR__ . '/_files'; |
|
34 | + $path = __DIR__.'/_files'; |
|
35 | 35 | |
36 | 36 | $locator = new DefaultFileLocator([$path, $path]); |
37 | 37 | self::assertSame([$path], $locator->getPaths()); |
@@ -39,16 +39,16 @@ discard block |
||
39 | 39 | |
40 | 40 | public function testFindMappingFile() |
41 | 41 | { |
42 | - $path = __DIR__ . '/_files'; |
|
42 | + $path = __DIR__.'/_files'; |
|
43 | 43 | |
44 | 44 | $locator = new DefaultFileLocator([$path], '.yml'); |
45 | 45 | |
46 | - self::assertSame(__DIR__ . '/_files' . DIRECTORY_SEPARATOR . 'stdClass.yml', $locator->findMappingFile('stdClass')); |
|
46 | + self::assertSame(__DIR__.'/_files'.DIRECTORY_SEPARATOR.'stdClass.yml', $locator->findMappingFile('stdClass')); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | public function testFindMappingFileNotFound() |
50 | 50 | { |
51 | - $path = __DIR__ . '/_files'; |
|
51 | + $path = __DIR__.'/_files'; |
|
52 | 52 | |
53 | 53 | $locator = new DefaultFileLocator([$path], '.yml'); |
54 | 54 | |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | |
60 | 60 | public function testGetAllClassNames() |
61 | 61 | { |
62 | - $path = __DIR__ . '/_files'; |
|
62 | + $path = __DIR__.'/_files'; |
|
63 | 63 | |
64 | 64 | $locator = new DefaultFileLocator([$path], '.yml'); |
65 | 65 | $allClasses = $locator->getAllClassNames(null); |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | |
80 | 80 | public function testGetAllClassNamesNonMatchingFileExtension() |
81 | 81 | { |
82 | - $path = __DIR__ . '/_files'; |
|
82 | + $path = __DIR__.'/_files'; |
|
83 | 83 | |
84 | 84 | $locator = new DefaultFileLocator([$path], '.xml'); |
85 | 85 | self::assertSame([], $locator->getAllClassNames('global')); |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | |
88 | 88 | public function testFileExists() |
89 | 89 | { |
90 | - $path = __DIR__ . '/_files'; |
|
90 | + $path = __DIR__.'/_files'; |
|
91 | 91 | |
92 | 92 | $locator = new DefaultFileLocator([$path], '.yml'); |
93 | 93 |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | { |
14 | 14 | public function testGetPaths() |
15 | 15 | { |
16 | - $path = __DIR__ . '/_files'; |
|
16 | + $path = __DIR__.'/_files'; |
|
17 | 17 | $prefix = 'Foo'; |
18 | 18 | |
19 | 19 | $locator = new SymfonyFileLocator([$path => $prefix]); |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | |
26 | 26 | public function testGetPrefixes() |
27 | 27 | { |
28 | - $path = __DIR__ . '/_files'; |
|
28 | + $path = __DIR__.'/_files'; |
|
29 | 29 | $prefix = 'Foo'; |
30 | 30 | |
31 | 31 | $locator = new SymfonyFileLocator([$path => $prefix]); |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | |
43 | 43 | public function testFileExists() |
44 | 44 | { |
45 | - $path = __DIR__ . '/_files'; |
|
45 | + $path = __DIR__.'/_files'; |
|
46 | 46 | $prefix = 'Foo'; |
47 | 47 | |
48 | 48 | $locator = new SymfonyFileLocator([$path => $prefix], '.yml'); |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | |
56 | 56 | public function testGetAllClassNames() |
57 | 57 | { |
58 | - $path = __DIR__ . '/_files'; |
|
58 | + $path = __DIR__.'/_files'; |
|
59 | 59 | $prefix = 'Foo'; |
60 | 60 | |
61 | 61 | $locator = new SymfonyFileLocator([$path => $prefix], '.yml'); |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | */ |
81 | 81 | public function testInvalidCustomNamespaceSeparator() |
82 | 82 | { |
83 | - $path = __DIR__ . '/_files'; |
|
83 | + $path = __DIR__.'/_files'; |
|
84 | 84 | $prefix = 'Foo'; |
85 | 85 | |
86 | 86 | new SymfonyFileLocator([$path => $prefix], '.yml', null); |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | */ |
105 | 105 | public function testGetClassNamesWithCustomNsSeparator($separator, $dir) |
106 | 106 | { |
107 | - $path = __DIR__ . $dir; |
|
107 | + $path = __DIR__.$dir; |
|
108 | 108 | $prefix = 'Foo'; |
109 | 109 | |
110 | 110 | $locator = new SymfonyFileLocator([$path => $prefix], '.yml', $separator); |
@@ -147,30 +147,30 @@ discard block |
||
147 | 147 | */ |
148 | 148 | public function testFindMappingFileWithCustomNsSeparator($separator, $dir, $files) |
149 | 149 | { |
150 | - $path = __DIR__ . $dir; |
|
150 | + $path = __DIR__.$dir; |
|
151 | 151 | $prefix = 'Foo'; |
152 | 152 | |
153 | 153 | $locator = new SymfonyFileLocator([$path => $prefix], '.yml', $separator); |
154 | 154 | |
155 | 155 | foreach ($files as $filePath => $className) { |
156 | - self::assertSame(realpath($path . '/' . $filePath), realpath($locator->findMappingFile($className))); |
|
156 | + self::assertSame(realpath($path.'/'.$filePath), realpath($locator->findMappingFile($className))); |
|
157 | 157 | } |
158 | 158 | } |
159 | 159 | |
160 | 160 | |
161 | 161 | public function testFindMappingFile() |
162 | 162 | { |
163 | - $path = __DIR__ . '/_files'; |
|
163 | + $path = __DIR__.'/_files'; |
|
164 | 164 | $prefix = 'Foo'; |
165 | 165 | |
166 | 166 | $locator = new SymfonyFileLocator([$path => $prefix], '.yml'); |
167 | 167 | |
168 | - self::assertSame(__DIR__ . '/_files/stdClass.yml', $locator->findMappingFile('Foo\\stdClass')); |
|
168 | + self::assertSame(__DIR__.'/_files/stdClass.yml', $locator->findMappingFile('Foo\\stdClass')); |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | public function testFindMappingFileNotFound() |
172 | 172 | { |
173 | - $path = __DIR__ . '/_files'; |
|
173 | + $path = __DIR__.'/_files'; |
|
174 | 174 | $prefix = 'Foo'; |
175 | 175 | |
176 | 176 | $locator = new SymfonyFileLocator([$path => $prefix], '.yml'); |
@@ -184,13 +184,13 @@ discard block |
||
184 | 184 | { |
185 | 185 | // Low -> High |
186 | 186 | $prefixes = []; |
187 | - $prefixes[__DIR__ . '/_match_ns'] = 'Foo'; |
|
188 | - $prefixes[__DIR__ . '/_match_ns/Bar'] = 'Foo\\Bar'; |
|
187 | + $prefixes[__DIR__.'/_match_ns'] = 'Foo'; |
|
188 | + $prefixes[__DIR__.'/_match_ns/Bar'] = 'Foo\\Bar'; |
|
189 | 189 | |
190 | 190 | $locator = new SymfonyFileLocator($prefixes, '.yml'); |
191 | 191 | |
192 | 192 | self::assertSame( |
193 | - __DIR__ . '/_match_ns/Bar/barEntity.yml', |
|
193 | + __DIR__.'/_match_ns/Bar/barEntity.yml', |
|
194 | 194 | $locator->findMappingFile("Foo\\Bar\\barEntity") |
195 | 195 | ); |
196 | 196 | } |
@@ -198,13 +198,13 @@ discard block |
||
198 | 198 | public function testFindMappingFileMostSpecificNamespaceFirst() |
199 | 199 | { |
200 | 200 | $prefixes = []; |
201 | - $prefixes[__DIR__ . '/_match_ns/Bar'] = 'Foo\\Bar'; |
|
202 | - $prefixes[__DIR__ . '/_match_ns'] = 'Foo'; |
|
201 | + $prefixes[__DIR__.'/_match_ns/Bar'] = 'Foo\\Bar'; |
|
202 | + $prefixes[__DIR__.'/_match_ns'] = 'Foo'; |
|
203 | 203 | |
204 | 204 | $locator = new SymfonyFileLocator($prefixes, '.yml'); |
205 | 205 | |
206 | 206 | self::assertSame( |
207 | - __DIR__ . '/_match_ns/Bar/barEntity.yml', |
|
207 | + __DIR__.'/_match_ns/Bar/barEntity.yml', |
|
208 | 208 | $locator->findMappingFile("Foo\\Bar\\barEntity") |
209 | 209 | ); |
210 | 210 | } |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | public function __construct($reader, $paths = null) |
80 | 80 | { |
81 | 81 | $this->reader = $reader; |
82 | - if (! $paths) { |
|
82 | + if (!$paths) { |
|
83 | 83 | return; |
84 | 84 | } |
85 | 85 | |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | return $this->classNames; |
193 | 193 | } |
194 | 194 | |
195 | - if (! $this->paths) { |
|
195 | + if (!$this->paths) { |
|
196 | 196 | throw MappingException::pathRequired(); |
197 | 197 | } |
198 | 198 | |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | $includedFiles = []; |
201 | 201 | |
202 | 202 | foreach ($this->paths as $path) { |
203 | - if (! is_dir($path)) { |
|
203 | + if (!is_dir($path)) { |
|
204 | 204 | throw MappingException::fileMappingDriversRequireConfiguredDirectoryPath($path); |
205 | 205 | } |
206 | 206 | |
@@ -209,14 +209,14 @@ discard block |
||
209 | 209 | new RecursiveDirectoryIterator($path, FilesystemIterator::SKIP_DOTS), |
210 | 210 | RecursiveIteratorIterator::LEAVES_ONLY |
211 | 211 | ), |
212 | - '/^.+' . preg_quote($this->fileExtension) . '$/i', |
|
212 | + '/^.+'.preg_quote($this->fileExtension).'$/i', |
|
213 | 213 | RecursiveRegexIterator::GET_MATCH |
214 | 214 | ); |
215 | 215 | |
216 | 216 | foreach ($iterator as $file) { |
217 | 217 | $sourceFile = $file[0]; |
218 | 218 | |
219 | - if (! preg_match('(^phar:)i', $sourceFile)) { |
|
219 | + if (!preg_match('(^phar:)i', $sourceFile)) { |
|
220 | 220 | $sourceFile = realpath($sourceFile); |
221 | 221 | } |
222 | 222 | |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | foreach ($declared as $className) { |
241 | 241 | $rc = new ReflectionClass($className); |
242 | 242 | $sourceFile = $rc->getFileName(); |
243 | - if (! in_array($sourceFile, $includedFiles) || $this->isTransient($className)) { |
|
243 | + if (!in_array($sourceFile, $includedFiles) || $this->isTransient($className)) { |
|
244 | 244 | continue; |
245 | 245 | } |
246 | 246 |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | return $this->classNames; |
75 | 75 | } |
76 | 76 | |
77 | - if (! $this->paths) { |
|
77 | + if (!$this->paths) { |
|
78 | 78 | throw MappingException::pathRequired(); |
79 | 79 | } |
80 | 80 | |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | $includedFiles = []; |
83 | 83 | |
84 | 84 | foreach ($this->paths as $path) { |
85 | - if (! is_dir($path)) { |
|
85 | + if (!is_dir($path)) { |
|
86 | 86 | throw MappingException::fileMappingDriversRequireConfiguredDirectoryPath($path); |
87 | 87 | } |
88 | 88 | |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | foreach ($declared as $className) { |
108 | 108 | $rc = new ReflectionClass($className); |
109 | 109 | $sourceFile = $rc->getFileName(); |
110 | - if (! in_array($sourceFile, $includedFiles) || $this->isTransient($className)) { |
|
110 | + if (!in_array($sourceFile, $includedFiles) || $this->isTransient($className)) { |
|
111 | 111 | continue; |
112 | 112 | } |
113 | 113 | |
@@ -124,6 +124,6 @@ discard block |
||
124 | 124 | */ |
125 | 125 | public function isTransient($className) |
126 | 126 | { |
127 | - return ! method_exists($className, 'loadMetadata'); |
|
127 | + return !method_exists($className, 'loadMetadata'); |
|
128 | 128 | } |
129 | 129 | } |
@@ -102,7 +102,7 @@ |
||
102 | 102 | */ |
103 | 103 | private function assertValidField($field) |
104 | 104 | { |
105 | - if (! isset($this->entityChangeSet[$field])) { |
|
105 | + if (!isset($this->entityChangeSet[$field])) { |
|
106 | 106 | throw new InvalidArgumentException(sprintf( |
107 | 107 | 'Field "%s" is not a valid field of the entity "%s" in PreUpdateEventArgs.', |
108 | 108 | $field, |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | $name = $this->defaultConnection; |
91 | 91 | } |
92 | 92 | |
93 | - if (! isset($this->connections[$name])) { |
|
93 | + if (!isset($this->connections[$name])) { |
|
94 | 94 | throw new InvalidArgumentException(sprintf('Doctrine %s Connection named "%s" does not exist.', $this->name, $name)); |
95 | 95 | } |
96 | 96 | |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | $name = $this->defaultManager; |
146 | 146 | } |
147 | 147 | |
148 | - if (! isset($this->managers[$name])) { |
|
148 | + if (!isset($this->managers[$name])) { |
|
149 | 149 | throw new InvalidArgumentException(sprintf('Doctrine %s Manager named "%s" does not exist.', $this->name, $name)); |
150 | 150 | } |
151 | 151 | |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | // Check for namespace alias |
161 | 161 | if (strpos($class, ':') !== false) { |
162 | 162 | [$namespaceAlias, $simpleClassName] = explode(':', $class, 2); |
163 | - $class = $this->getAliasNamespace($namespaceAlias) . '\\' . $simpleClassName; |
|
163 | + $class = $this->getAliasNamespace($namespaceAlias).'\\'.$simpleClassName; |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | $proxyClass = new ReflectionClass($class); |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | if ($proxyClass->implementsInterface($this->proxyInterfaceName)) { |
169 | 169 | $parentClass = $proxyClass->getParentClass(); |
170 | 170 | |
171 | - if (! $parentClass) { |
|
171 | + if (!$parentClass) { |
|
172 | 172 | return null; |
173 | 173 | } |
174 | 174 | |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | foreach ($this->managers as $id) { |
179 | 179 | $manager = $this->getService($id); |
180 | 180 | |
181 | - if (! $manager->getMetadataFactory()->isTransient($class)) { |
|
181 | + if (!$manager->getMetadataFactory()->isTransient($class)) { |
|
182 | 182 | return $manager; |
183 | 183 | } |
184 | 184 | } |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | $name = $this->defaultManager; |
223 | 223 | } |
224 | 224 | |
225 | - if (! isset($this->managers[$name])) { |
|
225 | + if (!isset($this->managers[$name])) { |
|
226 | 226 | throw new InvalidArgumentException(sprintf('Doctrine %s Manager named "%s" does not exist.', $this->name, $name)); |
227 | 227 | } |
228 | 228 |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | public function injectObjectManager(ObjectManager $objectManager, ClassMetadata $classMetadata) |
77 | 77 | { |
78 | 78 | if ($objectManager !== self::$objectManager) { |
79 | - throw new RuntimeException('Trying to use PersistentObject with different ObjectManager instances. ' . |
|
79 | + throw new RuntimeException('Trying to use PersistentObject with different ObjectManager instances. '. |
|
80 | 80 | 'Was PersistentObject::setObjectManager() called?'); |
81 | 81 | } |
82 | 82 | |
@@ -96,17 +96,17 @@ discard block |
||
96 | 96 | */ |
97 | 97 | private function set($field, $args) |
98 | 98 | { |
99 | - if ($this->cm->hasField($field) && ! $this->cm->isIdentifier($field)) { |
|
99 | + if ($this->cm->hasField($field) && !$this->cm->isIdentifier($field)) { |
|
100 | 100 | $this->$field = $args[0]; |
101 | 101 | } elseif ($this->cm->hasAssociation($field) && $this->cm->isSingleValuedAssociation($field)) { |
102 | 102 | $targetClass = $this->cm->getAssociationTargetClass($field); |
103 | - if (! ($args[0] instanceof $targetClass) && $args[0] !== null) { |
|
104 | - throw new InvalidArgumentException("Expected persistent object of type '" . $targetClass . "'"); |
|
103 | + if (!($args[0] instanceof $targetClass) && $args[0] !== null) { |
|
104 | + throw new InvalidArgumentException("Expected persistent object of type '".$targetClass."'"); |
|
105 | 105 | } |
106 | 106 | $this->$field = $args[0]; |
107 | 107 | $this->completeOwningSide($field, $targetClass, $args[0]); |
108 | 108 | } else { |
109 | - throw new BadMethodCallException("no field with name '" . $field . "' exists on '" . $this->cm->getName() . "'"); |
|
109 | + throw new BadMethodCallException("no field with name '".$field."' exists on '".$this->cm->getName()."'"); |
|
110 | 110 | } |
111 | 111 | } |
112 | 112 | |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | return $this->$field; |
126 | 126 | } |
127 | 127 | |
128 | - throw new BadMethodCallException("no field with name '" . $field . "' exists on '" . $this->cm->getName() . "'"); |
|
128 | + throw new BadMethodCallException("no field with name '".$field."' exists on '".$this->cm->getName()."'"); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | /** |
@@ -141,14 +141,14 @@ discard block |
||
141 | 141 | { |
142 | 142 | // add this object on the owning side as well, for obvious infinite recursion |
143 | 143 | // reasons this is only done when called on the inverse side. |
144 | - if (! $this->cm->isAssociationInverseSide($field)) { |
|
144 | + if (!$this->cm->isAssociationInverseSide($field)) { |
|
145 | 145 | return; |
146 | 146 | } |
147 | 147 | |
148 | 148 | $mappedByField = $this->cm->getAssociationMappedByTargetField($field); |
149 | 149 | $targetMetadata = self::$objectManager->getClassMetadata($targetClass); |
150 | 150 | |
151 | - $setter = ($targetMetadata->isCollectionValuedAssociation($mappedByField) ? 'add' : 'set') . $mappedByField; |
|
151 | + $setter = ($targetMetadata->isCollectionValuedAssociation($mappedByField) ? 'add' : 'set').$mappedByField; |
|
152 | 152 | $targetObject->$setter($this); |
153 | 153 | } |
154 | 154 | |
@@ -165,15 +165,15 @@ discard block |
||
165 | 165 | */ |
166 | 166 | private function add($field, $args) |
167 | 167 | { |
168 | - if (! $this->cm->hasAssociation($field) || ! $this->cm->isCollectionValuedAssociation($field)) { |
|
169 | - throw new BadMethodCallException('There is no method add' . $field . '() on ' . $this->cm->getName()); |
|
168 | + if (!$this->cm->hasAssociation($field) || !$this->cm->isCollectionValuedAssociation($field)) { |
|
169 | + throw new BadMethodCallException('There is no method add'.$field.'() on '.$this->cm->getName()); |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | $targetClass = $this->cm->getAssociationTargetClass($field); |
173 | - if (! ($args[0] instanceof $targetClass)) { |
|
174 | - throw new InvalidArgumentException("Expected persistent object of type '" . $targetClass . "'"); |
|
173 | + if (!($args[0] instanceof $targetClass)) { |
|
174 | + throw new InvalidArgumentException("Expected persistent object of type '".$targetClass."'"); |
|
175 | 175 | } |
176 | - if (! ($this->$field instanceof Collection)) { |
|
176 | + if (!($this->$field instanceof Collection)) { |
|
177 | 177 | $this->$field = new ArrayCollection($this->$field ?: []); |
178 | 178 | } |
179 | 179 | $this->$field->add($args[0]); |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | return; |
194 | 194 | } |
195 | 195 | |
196 | - if (! self::$objectManager) { |
|
196 | + if (!self::$objectManager) { |
|
197 | 197 | throw new RuntimeException('No runtime object manager set. Call PersistentObject#setObjectManager().'); |
198 | 198 | } |
199 | 199 | |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | } elseif ($command === 'add') { |
224 | 224 | $this->add($field, $args); |
225 | 225 | } else { |
226 | - throw new BadMethodCallException('There is no method ' . $method . ' on ' . $this->cm->getName()); |
|
226 | + throw new BadMethodCallException('There is no method '.$method.' on '.$this->cm->getName()); |
|
227 | 227 | } |
228 | 228 | } |
229 | 229 | } |