@@ -4,9 +4,7 @@ |
||
| 4 | 4 | |
| 5 | 5 | use Doctrine\ORM\EntityManagerInterface; |
| 6 | 6 | use Doctrine\ORM\Proxy\ProxyFactory; |
| 7 | -use Doctrine\ORM\Query; |
|
| 8 | 7 | use Doctrine\ORM\Query\ResultSetMapping; |
| 9 | -use Doctrine\Tests\ORM\Performance\MockUnitOfWork; |
|
| 10 | 8 | |
| 11 | 9 | /** |
| 12 | 10 | * An entity manager mock that prevents lazy-loading of proxies |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | /** |
| 130 | - * @param field_type $fooTitle |
|
| 130 | + * @param string $fooTitle |
|
| 131 | 131 | */ |
| 132 | 132 | public function setFooTitle($fooTitle) |
| 133 | 133 | { |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | } |
| 206 | 206 | |
| 207 | 207 | /** |
| 208 | - * @param field_type $barTitle |
|
| 208 | + * @param string $barTitle |
|
| 209 | 209 | */ |
| 210 | 210 | public function setBarTitle($barTitle) |
| 211 | 211 | { |
@@ -301,14 +301,14 @@ |
||
| 301 | 301 | */ |
| 302 | 302 | private function resolveMagicCall($method, $by, array $arguments) |
| 303 | 303 | { |
| 304 | - if (! $arguments) { |
|
| 305 | - throw ORMException::findByRequiresParameter($method . $by); |
|
| 304 | + if ( ! $arguments) { |
|
| 305 | + throw ORMException::findByRequiresParameter($method.$by); |
|
| 306 | 306 | } |
| 307 | 307 | |
| 308 | 308 | $fieldName = lcfirst(Inflector::classify($by)); |
| 309 | 309 | |
| 310 | - if (! ($this->_class->hasField($fieldName) || $this->_class->hasAssociation($fieldName))) { |
|
| 311 | - throw ORMException::invalidMagicCall($this->_entityName, $fieldName, $method . $by); |
|
| 310 | + if ( ! ($this->_class->hasField($fieldName) || $this->_class->hasAssociation($fieldName))) { |
|
| 311 | + throw ORMException::invalidMagicCall($this->_entityName, $fieldName, $method.$by); |
|
| 312 | 312 | } |
| 313 | 313 | |
| 314 | 314 | return $this->$method([$fieldName => $arguments[0]], ...array_slice($arguments, 1)); |
@@ -33,7 +33,6 @@ |
||
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | /** |
| 36 | - * @param \Doctrine\ORM\EntityManager $entityClassName |
|
| 37 | 36 | * @return \Doctrine\ORM\Mapping\ClassMetadataFactory |
| 38 | 37 | */ |
| 39 | 38 | protected function createClassMetadataFactory(EntityManager $em = null) |
@@ -739,7 +739,7 @@ discard block |
||
| 739 | 739 | $this->assertEquals($guestGroups['isCascadeMerge'], $adminGroups['isCascadeMerge']); |
| 740 | 740 | $this->assertEquals($guestGroups['isCascadeDetach'], $adminGroups['isCascadeDetach']); |
| 741 | 741 | |
| 742 | - // assert not override attributes |
|
| 742 | + // assert not override attributes |
|
| 743 | 743 | $this->assertEquals('ddc964_users_groups', $guestGroups['joinTable']['name']); |
| 744 | 744 | $this->assertEquals('user_id', $guestGroups['joinTable']['joinColumns'][0]['name']); |
| 745 | 745 | $this->assertEquals('group_id', $guestGroups['joinTable']['inverseJoinColumns'][0]['name']); |
@@ -1166,8 +1166,8 @@ discard block |
||
| 1166 | 1166 | $metadata->setInheritanceType(ClassMetadataInfo::INHERITANCE_TYPE_NONE); |
| 1167 | 1167 | $metadata->setPrimaryTable( |
| 1168 | 1168 | [ |
| 1169 | - 'name' => 'cms_users', |
|
| 1170 | - 'options' => ['foo' => 'bar', 'baz' => ['key' => 'val']], |
|
| 1169 | + 'name' => 'cms_users', |
|
| 1170 | + 'options' => ['foo' => 'bar', 'baz' => ['key' => 'val']], |
|
| 1171 | 1171 | ] |
| 1172 | 1172 | ); |
| 1173 | 1173 | $metadata->setChangeTrackingPolicy(ClassMetadataInfo::CHANGETRACKING_DEFERRED_IMPLICIT); |
@@ -1176,30 +1176,30 @@ discard block |
||
| 1176 | 1176 | $metadata->addLifecycleCallback('doStuffOnPostPersist', 'postPersist'); |
| 1177 | 1177 | $metadata->mapField( |
| 1178 | 1178 | [ |
| 1179 | - 'id' => true, |
|
| 1180 | - 'fieldName' => 'id', |
|
| 1181 | - 'type' => 'integer', |
|
| 1182 | - 'columnName' => 'id', |
|
| 1183 | - 'options' => ['foo' => 'bar', 'unsigned' => false], |
|
| 1179 | + 'id' => true, |
|
| 1180 | + 'fieldName' => 'id', |
|
| 1181 | + 'type' => 'integer', |
|
| 1182 | + 'columnName' => 'id', |
|
| 1183 | + 'options' => ['foo' => 'bar', 'unsigned' => false], |
|
| 1184 | 1184 | ] |
| 1185 | 1185 | ); |
| 1186 | 1186 | $metadata->mapField( |
| 1187 | 1187 | [ |
| 1188 | - 'fieldName' => 'name', |
|
| 1189 | - 'type' => 'string', |
|
| 1190 | - 'length' => 50, |
|
| 1191 | - 'unique' => true, |
|
| 1192 | - 'nullable' => true, |
|
| 1193 | - 'columnName' => 'name', |
|
| 1194 | - 'options' => ['foo' => 'bar', 'baz' => ['key' => 'val'], 'fixed' => false], |
|
| 1188 | + 'fieldName' => 'name', |
|
| 1189 | + 'type' => 'string', |
|
| 1190 | + 'length' => 50, |
|
| 1191 | + 'unique' => true, |
|
| 1192 | + 'nullable' => true, |
|
| 1193 | + 'columnName' => 'name', |
|
| 1194 | + 'options' => ['foo' => 'bar', 'baz' => ['key' => 'val'], 'fixed' => false], |
|
| 1195 | 1195 | ] |
| 1196 | 1196 | ); |
| 1197 | 1197 | $metadata->mapField( |
| 1198 | 1198 | [ |
| 1199 | - 'fieldName' => 'email', |
|
| 1200 | - 'type' => 'string', |
|
| 1201 | - 'columnName' => 'user_email', |
|
| 1202 | - 'columnDefinition' => 'CHAR(32) NOT NULL', |
|
| 1199 | + 'fieldName' => 'email', |
|
| 1200 | + 'type' => 'string', |
|
| 1201 | + 'columnName' => 'user_email', |
|
| 1202 | + 'columnDefinition' => 'CHAR(32) NOT NULL', |
|
| 1203 | 1203 | ] |
| 1204 | 1204 | ); |
| 1205 | 1205 | $mapping = ['fieldName' => 'version', 'type' => 'integer']; |
@@ -1208,60 +1208,60 @@ discard block |
||
| 1208 | 1208 | $metadata->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_AUTO); |
| 1209 | 1209 | $metadata->mapOneToOne( |
| 1210 | 1210 | [ |
| 1211 | - 'fieldName' => 'address', |
|
| 1212 | - 'targetEntity' => Address::class, |
|
| 1213 | - 'cascade' => |
|
| 1214 | - [ |
|
| 1215 | - 0 => 'remove', |
|
| 1216 | - ], |
|
| 1217 | - 'mappedBy' => NULL, |
|
| 1218 | - 'inversedBy' => 'user', |
|
| 1219 | - 'joinColumns' => |
|
| 1220 | - [ |
|
| 1221 | - 0 => |
|
| 1222 | - [ |
|
| 1211 | + 'fieldName' => 'address', |
|
| 1212 | + 'targetEntity' => Address::class, |
|
| 1213 | + 'cascade' => |
|
| 1214 | + [ |
|
| 1215 | + 0 => 'remove', |
|
| 1216 | + ], |
|
| 1217 | + 'mappedBy' => NULL, |
|
| 1218 | + 'inversedBy' => 'user', |
|
| 1219 | + 'joinColumns' => |
|
| 1220 | + [ |
|
| 1221 | + 0 => |
|
| 1222 | + [ |
|
| 1223 | 1223 | 'name' => 'address_id', |
| 1224 | 1224 | 'referencedColumnName' => 'id', |
| 1225 | 1225 | 'onDelete' => 'CASCADE', |
| 1226 | - ], |
|
| 1227 | - ], |
|
| 1228 | - 'orphanRemoval' => false, |
|
| 1226 | + ], |
|
| 1227 | + ], |
|
| 1228 | + 'orphanRemoval' => false, |
|
| 1229 | 1229 | ] |
| 1230 | 1230 | ); |
| 1231 | 1231 | $metadata->mapOneToMany( |
| 1232 | 1232 | [ |
| 1233 | - 'fieldName' => 'phonenumbers', |
|
| 1234 | - 'targetEntity' => Phonenumber::class, |
|
| 1235 | - 'cascade' => |
|
| 1236 | - [ |
|
| 1237 | - 1 => 'persist', |
|
| 1238 | - ], |
|
| 1239 | - 'mappedBy' => 'user', |
|
| 1240 | - 'orphanRemoval' => true, |
|
| 1241 | - 'orderBy' => |
|
| 1242 | - [ |
|
| 1243 | - 'number' => 'ASC', |
|
| 1244 | - ], |
|
| 1233 | + 'fieldName' => 'phonenumbers', |
|
| 1234 | + 'targetEntity' => Phonenumber::class, |
|
| 1235 | + 'cascade' => |
|
| 1236 | + [ |
|
| 1237 | + 1 => 'persist', |
|
| 1238 | + ], |
|
| 1239 | + 'mappedBy' => 'user', |
|
| 1240 | + 'orphanRemoval' => true, |
|
| 1241 | + 'orderBy' => |
|
| 1242 | + [ |
|
| 1243 | + 'number' => 'ASC', |
|
| 1244 | + ], |
|
| 1245 | 1245 | ] |
| 1246 | 1246 | ); |
| 1247 | 1247 | $metadata->mapManyToMany( |
| 1248 | 1248 | [ |
| 1249 | - 'fieldName' => 'groups', |
|
| 1250 | - 'targetEntity' => Group::class, |
|
| 1251 | - 'cascade' => |
|
| 1252 | - [ |
|
| 1253 | - 0 => 'remove', |
|
| 1254 | - 1 => 'persist', |
|
| 1255 | - 2 => 'refresh', |
|
| 1256 | - 3 => 'merge', |
|
| 1257 | - 4 => 'detach', |
|
| 1258 | - ], |
|
| 1259 | - 'mappedBy' => NULL, |
|
| 1260 | - 'joinTable' => |
|
| 1261 | - [ |
|
| 1262 | - 'name' => 'cms_users_groups', |
|
| 1263 | - 'joinColumns' => |
|
| 1264 | - [ |
|
| 1249 | + 'fieldName' => 'groups', |
|
| 1250 | + 'targetEntity' => Group::class, |
|
| 1251 | + 'cascade' => |
|
| 1252 | + [ |
|
| 1253 | + 0 => 'remove', |
|
| 1254 | + 1 => 'persist', |
|
| 1255 | + 2 => 'refresh', |
|
| 1256 | + 3 => 'merge', |
|
| 1257 | + 4 => 'detach', |
|
| 1258 | + ], |
|
| 1259 | + 'mappedBy' => NULL, |
|
| 1260 | + 'joinTable' => |
|
| 1261 | + [ |
|
| 1262 | + 'name' => 'cms_users_groups', |
|
| 1263 | + 'joinColumns' => |
|
| 1264 | + [ |
|
| 1265 | 1265 | 0 => |
| 1266 | 1266 | [ |
| 1267 | 1267 | 'name' => 'user_id', |
@@ -1269,18 +1269,18 @@ discard block |
||
| 1269 | 1269 | 'unique' => false, |
| 1270 | 1270 | 'nullable' => false, |
| 1271 | 1271 | ], |
| 1272 | - ], |
|
| 1273 | - 'inverseJoinColumns' => |
|
| 1274 | - [ |
|
| 1272 | + ], |
|
| 1273 | + 'inverseJoinColumns' => |
|
| 1274 | + [ |
|
| 1275 | 1275 | 0 => |
| 1276 | 1276 | [ |
| 1277 | 1277 | 'name' => 'group_id', |
| 1278 | 1278 | 'referencedColumnName' => 'id', |
| 1279 | 1279 | 'columnDefinition' => 'INT NULL', |
| 1280 | 1280 | ], |
| 1281 | - ], |
|
| 1282 | - ], |
|
| 1283 | - 'orderBy' => NULL, |
|
| 1281 | + ], |
|
| 1282 | + ], |
|
| 1283 | + 'orderBy' => NULL, |
|
| 1284 | 1284 | ] |
| 1285 | 1285 | ); |
| 1286 | 1286 | $metadata->table['uniqueConstraints'] = [ |
@@ -1391,9 +1391,9 @@ discard block |
||
| 1391 | 1391 | { |
| 1392 | 1392 | $metadata->mapField( |
| 1393 | 1393 | [ |
| 1394 | - 'id' => true, |
|
| 1395 | - 'fieldName' => 'id', |
|
| 1396 | - 'columnDefinition' => 'INT unsigned NOT NULL', |
|
| 1394 | + 'id' => true, |
|
| 1395 | + 'fieldName' => 'id', |
|
| 1396 | + 'columnDefinition' => 'INT unsigned NOT NULL', |
|
| 1397 | 1397 | ] |
| 1398 | 1398 | ); |
| 1399 | 1399 | |
@@ -1422,16 +1422,16 @@ discard block |
||
| 1422 | 1422 | * @Column(type="integer") |
| 1423 | 1423 | * @GeneratedValue(strategy="NONE") |
| 1424 | 1424 | **/ |
| 1425 | - public $id; |
|
| 1425 | + public $id; |
|
| 1426 | 1426 | |
| 1427 | - public static function loadMetadata(ClassMetadataInfo $metadata) |
|
| 1427 | + public static function loadMetadata(ClassMetadataInfo $metadata) |
|
| 1428 | 1428 | { |
| 1429 | - $metadata->mapField( |
|
| 1430 | - [ |
|
| 1431 | - 'id' => true, |
|
| 1432 | - 'fieldName' => 'id', |
|
| 1433 | - ] |
|
| 1434 | - ); |
|
| 1429 | + $metadata->mapField( |
|
| 1430 | + [ |
|
| 1431 | + 'id' => true, |
|
| 1432 | + 'fieldName' => 'id', |
|
| 1433 | + ] |
|
| 1434 | + ); |
|
| 1435 | 1435 | |
| 1436 | 1436 | $metadata->setDiscriminatorColumn( |
| 1437 | 1437 | [ |
@@ -605,13 +605,13 @@ discard block |
||
| 605 | 605 | |
| 606 | 606 | $findByIdQuery = $class->getNamedNativeQuery('find-by-id'); |
| 607 | 607 | $this->assertEquals('find-by-id', $findByIdQuery['name']); |
| 608 | - $this->assertEquals(CmsAddress::class,$findByIdQuery['resultClass']); |
|
| 609 | - $this->assertEquals('SELECT * FROM cms_addresses WHERE id = ?', $findByIdQuery['query']); |
|
| 608 | + $this->assertEquals(CmsAddress::class, $findByIdQuery['resultClass']); |
|
| 609 | + $this->assertEquals('SELECT * FROM cms_addresses WHERE id = ?', $findByIdQuery['query']); |
|
| 610 | 610 | |
| 611 | 611 | $countQuery = $class->getNamedNativeQuery('count'); |
| 612 | 612 | $this->assertEquals('count', $countQuery['name']); |
| 613 | 613 | $this->assertEquals('mapping-count', $countQuery['resultSetMapping']); |
| 614 | - $this->assertEquals('SELECT COUNT(*) AS count FROM cms_addresses', $countQuery['query']); |
|
| 614 | + $this->assertEquals('SELECT COUNT(*) AS count FROM cms_addresses', $countQuery['query']); |
|
| 615 | 615 | |
| 616 | 616 | // result set mapping |
| 617 | 617 | $this->assertCount(3, $class->sqlResultSetMappings); |
@@ -622,9 +622,9 @@ discard block |
||
| 622 | 622 | $findAllMapping = $class->getSqlResultSetMapping('mapping-find-all'); |
| 623 | 623 | $this->assertEquals('mapping-find-all', $findAllMapping['name']); |
| 624 | 624 | $this->assertEquals(CmsAddress::class, $findAllMapping['entities'][0]['entityClass']); |
| 625 | - $this->assertEquals(['name'=>'id','column'=>'id'], $findAllMapping['entities'][0]['fields'][0]); |
|
| 626 | - $this->assertEquals(['name'=>'city','column'=>'city'], $findAllMapping['entities'][0]['fields'][1]); |
|
| 627 | - $this->assertEquals(['name'=>'country','column'=>'country'], $findAllMapping['entities'][0]['fields'][2]); |
|
| 625 | + $this->assertEquals(['name'=>'id', 'column'=>'id'], $findAllMapping['entities'][0]['fields'][0]); |
|
| 626 | + $this->assertEquals(['name'=>'city', 'column'=>'city'], $findAllMapping['entities'][0]['fields'][1]); |
|
| 627 | + $this->assertEquals(['name'=>'country', 'column'=>'country'], $findAllMapping['entities'][0]['fields'][2]); |
|
| 628 | 628 | |
| 629 | 629 | $withoutFieldsMapping = $class->getSqlResultSetMapping('mapping-without-fields'); |
| 630 | 630 | $this->assertEquals('mapping-without-fields', $withoutFieldsMapping['name']); |
@@ -650,62 +650,62 @@ discard block |
||
| 650 | 650 | $this->assertCount(4, $userMetadata->getSqlResultSetMappings()); |
| 651 | 651 | |
| 652 | 652 | $mapping = $userMetadata->getSqlResultSetMapping('mappingJoinedAddress'); |
| 653 | - $this->assertEquals([],$mapping['columns']); |
|
| 653 | + $this->assertEquals([], $mapping['columns']); |
|
| 654 | 654 | $this->assertEquals('mappingJoinedAddress', $mapping['name']); |
| 655 | 655 | $this->assertNull($mapping['entities'][0]['discriminatorColumn']); |
| 656 | - $this->assertEquals(['name'=>'id','column'=>'id'], $mapping['entities'][0]['fields'][0]); |
|
| 657 | - $this->assertEquals(['name'=>'name','column'=>'name'], $mapping['entities'][0]['fields'][1]); |
|
| 658 | - $this->assertEquals(['name'=>'status','column'=>'status'], $mapping['entities'][0]['fields'][2]); |
|
| 659 | - $this->assertEquals(['name'=>'address.zip','column'=>'zip'], $mapping['entities'][0]['fields'][3]); |
|
| 660 | - $this->assertEquals(['name'=>'address.city','column'=>'city'], $mapping['entities'][0]['fields'][4]); |
|
| 661 | - $this->assertEquals(['name'=>'address.country','column'=>'country'], $mapping['entities'][0]['fields'][5]); |
|
| 662 | - $this->assertEquals(['name'=>'address.id','column'=>'a_id'], $mapping['entities'][0]['fields'][6]); |
|
| 663 | - $this->assertEquals($userMetadata->name, $mapping['entities'][0]['entityClass']); |
|
| 656 | + $this->assertEquals(['name'=>'id', 'column'=>'id'], $mapping['entities'][0]['fields'][0]); |
|
| 657 | + $this->assertEquals(['name'=>'name', 'column'=>'name'], $mapping['entities'][0]['fields'][1]); |
|
| 658 | + $this->assertEquals(['name'=>'status', 'column'=>'status'], $mapping['entities'][0]['fields'][2]); |
|
| 659 | + $this->assertEquals(['name'=>'address.zip', 'column'=>'zip'], $mapping['entities'][0]['fields'][3]); |
|
| 660 | + $this->assertEquals(['name'=>'address.city', 'column'=>'city'], $mapping['entities'][0]['fields'][4]); |
|
| 661 | + $this->assertEquals(['name'=>'address.country', 'column'=>'country'], $mapping['entities'][0]['fields'][5]); |
|
| 662 | + $this->assertEquals(['name'=>'address.id', 'column'=>'a_id'], $mapping['entities'][0]['fields'][6]); |
|
| 663 | + $this->assertEquals($userMetadata->name, $mapping['entities'][0]['entityClass']); |
|
| 664 | 664 | |
| 665 | 665 | |
| 666 | 666 | $mapping = $userMetadata->getSqlResultSetMapping('mappingJoinedPhonenumber'); |
| 667 | - $this->assertEquals([],$mapping['columns']); |
|
| 667 | + $this->assertEquals([], $mapping['columns']); |
|
| 668 | 668 | $this->assertEquals('mappingJoinedPhonenumber', $mapping['name']); |
| 669 | 669 | $this->assertNull($mapping['entities'][0]['discriminatorColumn']); |
| 670 | - $this->assertEquals(['name'=>'id','column'=>'id'], $mapping['entities'][0]['fields'][0]); |
|
| 671 | - $this->assertEquals(['name'=>'name','column'=>'name'], $mapping['entities'][0]['fields'][1]); |
|
| 672 | - $this->assertEquals(['name'=>'status','column'=>'status'], $mapping['entities'][0]['fields'][2]); |
|
| 673 | - $this->assertEquals(['name'=>'phonenumbers.phonenumber','column'=>'number'], $mapping['entities'][0]['fields'][3]); |
|
| 674 | - $this->assertEquals($userMetadata->name, $mapping['entities'][0]['entityClass']); |
|
| 670 | + $this->assertEquals(['name'=>'id', 'column'=>'id'], $mapping['entities'][0]['fields'][0]); |
|
| 671 | + $this->assertEquals(['name'=>'name', 'column'=>'name'], $mapping['entities'][0]['fields'][1]); |
|
| 672 | + $this->assertEquals(['name'=>'status', 'column'=>'status'], $mapping['entities'][0]['fields'][2]); |
|
| 673 | + $this->assertEquals(['name'=>'phonenumbers.phonenumber', 'column'=>'number'], $mapping['entities'][0]['fields'][3]); |
|
| 674 | + $this->assertEquals($userMetadata->name, $mapping['entities'][0]['entityClass']); |
|
| 675 | 675 | |
| 676 | 676 | $mapping = $userMetadata->getSqlResultSetMapping('mappingUserPhonenumberCount'); |
| 677 | - $this->assertEquals(['name'=>'numphones'],$mapping['columns'][0]); |
|
| 677 | + $this->assertEquals(['name'=>'numphones'], $mapping['columns'][0]); |
|
| 678 | 678 | $this->assertEquals('mappingUserPhonenumberCount', $mapping['name']); |
| 679 | 679 | $this->assertNull($mapping['entities'][0]['discriminatorColumn']); |
| 680 | - $this->assertEquals(['name'=>'id','column'=>'id'], $mapping['entities'][0]['fields'][0]); |
|
| 681 | - $this->assertEquals(['name'=>'name','column'=>'name'], $mapping['entities'][0]['fields'][1]); |
|
| 682 | - $this->assertEquals(['name'=>'status','column'=>'status'], $mapping['entities'][0]['fields'][2]); |
|
| 683 | - $this->assertEquals($userMetadata->name, $mapping['entities'][0]['entityClass']); |
|
| 680 | + $this->assertEquals(['name'=>'id', 'column'=>'id'], $mapping['entities'][0]['fields'][0]); |
|
| 681 | + $this->assertEquals(['name'=>'name', 'column'=>'name'], $mapping['entities'][0]['fields'][1]); |
|
| 682 | + $this->assertEquals(['name'=>'status', 'column'=>'status'], $mapping['entities'][0]['fields'][2]); |
|
| 683 | + $this->assertEquals($userMetadata->name, $mapping['entities'][0]['entityClass']); |
|
| 684 | 684 | |
| 685 | 685 | $mapping = $userMetadata->getSqlResultSetMapping('mappingMultipleJoinsEntityResults'); |
| 686 | - $this->assertEquals(['name'=>'numphones'],$mapping['columns'][0]); |
|
| 686 | + $this->assertEquals(['name'=>'numphones'], $mapping['columns'][0]); |
|
| 687 | 687 | $this->assertEquals('mappingMultipleJoinsEntityResults', $mapping['name']); |
| 688 | 688 | $this->assertNull($mapping['entities'][0]['discriminatorColumn']); |
| 689 | - $this->assertEquals(['name'=>'id','column'=>'u_id'], $mapping['entities'][0]['fields'][0]); |
|
| 690 | - $this->assertEquals(['name'=>'name','column'=>'u_name'], $mapping['entities'][0]['fields'][1]); |
|
| 691 | - $this->assertEquals(['name'=>'status','column'=>'u_status'], $mapping['entities'][0]['fields'][2]); |
|
| 692 | - $this->assertEquals($userMetadata->name, $mapping['entities'][0]['entityClass']); |
|
| 689 | + $this->assertEquals(['name'=>'id', 'column'=>'u_id'], $mapping['entities'][0]['fields'][0]); |
|
| 690 | + $this->assertEquals(['name'=>'name', 'column'=>'u_name'], $mapping['entities'][0]['fields'][1]); |
|
| 691 | + $this->assertEquals(['name'=>'status', 'column'=>'u_status'], $mapping['entities'][0]['fields'][2]); |
|
| 692 | + $this->assertEquals($userMetadata->name, $mapping['entities'][0]['entityClass']); |
|
| 693 | 693 | $this->assertNull($mapping['entities'][1]['discriminatorColumn']); |
| 694 | - $this->assertEquals(['name'=>'id','column'=>'a_id'], $mapping['entities'][1]['fields'][0]); |
|
| 695 | - $this->assertEquals(['name'=>'zip','column'=>'a_zip'], $mapping['entities'][1]['fields'][1]); |
|
| 696 | - $this->assertEquals(['name'=>'country','column'=>'a_country'], $mapping['entities'][1]['fields'][2]); |
|
| 697 | - $this->assertEquals(CmsAddress::class, $mapping['entities'][1]['entityClass']); |
|
| 694 | + $this->assertEquals(['name'=>'id', 'column'=>'a_id'], $mapping['entities'][1]['fields'][0]); |
|
| 695 | + $this->assertEquals(['name'=>'zip', 'column'=>'a_zip'], $mapping['entities'][1]['fields'][1]); |
|
| 696 | + $this->assertEquals(['name'=>'country', 'column'=>'a_country'], $mapping['entities'][1]['fields'][2]); |
|
| 697 | + $this->assertEquals(CmsAddress::class, $mapping['entities'][1]['entityClass']); |
|
| 698 | 698 | |
| 699 | 699 | //person asserts |
| 700 | 700 | $this->assertCount(1, $personMetadata->getSqlResultSetMappings()); |
| 701 | 701 | |
| 702 | 702 | $mapping = $personMetadata->getSqlResultSetMapping('mappingFetchAll'); |
| 703 | - $this->assertEquals([],$mapping['columns']); |
|
| 703 | + $this->assertEquals([], $mapping['columns']); |
|
| 704 | 704 | $this->assertEquals('mappingFetchAll', $mapping['name']); |
| 705 | - $this->assertEquals('discriminator', $mapping['entities'][0]['discriminatorColumn']); |
|
| 706 | - $this->assertEquals(['name'=>'id','column'=>'id'], $mapping['entities'][0]['fields'][0]); |
|
| 707 | - $this->assertEquals(['name'=>'name','column'=>'name'], $mapping['entities'][0]['fields'][1]); |
|
| 708 | - $this->assertEquals($personMetadata->name, $mapping['entities'][0]['entityClass']); |
|
| 705 | + $this->assertEquals('discriminator', $mapping['entities'][0]['discriminatorColumn']); |
|
| 706 | + $this->assertEquals(['name'=>'id', 'column'=>'id'], $mapping['entities'][0]['fields'][0]); |
|
| 707 | + $this->assertEquals(['name'=>'name', 'column'=>'name'], $mapping['entities'][0]['fields'][1]); |
|
| 708 | + $this->assertEquals($personMetadata->name, $mapping['entities'][0]['entityClass']); |
|
| 709 | 709 | } |
| 710 | 710 | |
| 711 | 711 | /* |
@@ -746,7 +746,7 @@ discard block |
||
| 746 | 746 | |
| 747 | 747 | $this->assertEquals(['user_id'=>'id'], $guestGroups['relationToSourceKeyColumns']); |
| 748 | 748 | $this->assertEquals(['group_id'=>'id'], $guestGroups['relationToTargetKeyColumns']); |
| 749 | - $this->assertEquals(['user_id','group_id'], $guestGroups['joinTableColumns']); |
|
| 749 | + $this->assertEquals(['user_id', 'group_id'], $guestGroups['joinTableColumns']); |
|
| 750 | 750 | |
| 751 | 751 | |
| 752 | 752 | $this->assertEquals('ddc964_users_admingroups', $adminGroups['joinTable']['name']); |
@@ -755,7 +755,7 @@ discard block |
||
| 755 | 755 | |
| 756 | 756 | $this->assertEquals(['adminuser_id'=>'id'], $adminGroups['relationToSourceKeyColumns']); |
| 757 | 757 | $this->assertEquals(['admingroup_id'=>'id'], $adminGroups['relationToTargetKeyColumns']); |
| 758 | - $this->assertEquals(['adminuser_id','admingroup_id'], $adminGroups['joinTableColumns']); |
|
| 758 | + $this->assertEquals(['adminuser_id', 'admingroup_id'], $adminGroups['joinTableColumns']); |
|
| 759 | 759 | |
| 760 | 760 | |
| 761 | 761 | // assert address association mappings |
@@ -833,8 +833,8 @@ discard block |
||
| 833 | 833 | $this->assertTrue($adminMetadata->fieldMappings['id']['id']); |
| 834 | 834 | $this->assertEquals('id', $adminMetadata->fieldMappings['id']['fieldName']); |
| 835 | 835 | $this->assertEquals('user_id', $adminMetadata->fieldMappings['id']['columnName']); |
| 836 | - $this->assertEquals(['user_id'=>'id','user_name'=>'name'], $adminMetadata->fieldNames); |
|
| 837 | - $this->assertEquals(['id'=>'user_id','name'=>'user_name'], $adminMetadata->columnNames); |
|
| 836 | + $this->assertEquals(['user_id'=>'id', 'user_name'=>'name'], $adminMetadata->fieldNames); |
|
| 837 | + $this->assertEquals(['id'=>'user_id', 'name'=>'user_name'], $adminMetadata->columnNames); |
|
| 838 | 838 | $this->assertEquals(150, $adminMetadata->fieldMappings['id']['length']); |
| 839 | 839 | |
| 840 | 840 | |
@@ -848,8 +848,8 @@ discard block |
||
| 848 | 848 | $this->assertTrue($guestMetadata->fieldMappings['id']['id']); |
| 849 | 849 | $this->assertEquals('guest_id', $guestMetadata->fieldMappings['id']['columnName']); |
| 850 | 850 | $this->assertEquals('id', $guestMetadata->fieldMappings['id']['fieldName']); |
| 851 | - $this->assertEquals(['guest_id'=>'id','guest_name'=>'name'], $guestMetadata->fieldNames); |
|
| 852 | - $this->assertEquals(['id'=>'guest_id','name'=>'guest_name'], $guestMetadata->columnNames); |
|
| 851 | + $this->assertEquals(['guest_id'=>'id', 'guest_name'=>'name'], $guestMetadata->fieldNames); |
|
| 852 | + $this->assertEquals(['id'=>'guest_id', 'name'=>'guest_name'], $guestMetadata->columnNames); |
|
| 853 | 853 | $this->assertEquals(140, $guestMetadata->fieldMappings['id']['length']); |
| 854 | 854 | |
| 855 | 855 | $this->assertEquals('name', $guestMetadata->fieldMappings['name']['fieldName']); |
@@ -224,8 +224,8 @@ discard block |
||
| 224 | 224 | */ |
| 225 | 225 | public function transactional($func) |
| 226 | 226 | { |
| 227 | - if (!is_callable($func)) { |
|
| 228 | - throw new \InvalidArgumentException('Expected argument of type "callable", got "' . gettype($func) . '"'); |
|
| 227 | + if ( ! is_callable($func)) { |
|
| 228 | + throw new \InvalidArgumentException('Expected argument of type "callable", got "'.gettype($func).'"'); |
|
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | $this->conn->beginTransaction(); |
@@ -753,7 +753,7 @@ discard block |
||
| 753 | 753 | */ |
| 754 | 754 | public function isOpen() |
| 755 | 755 | { |
| 756 | - return (!$this->closed); |
|
| 756 | + return ( ! $this->closed); |
|
| 757 | 757 | } |
| 758 | 758 | |
| 759 | 759 | /** |
@@ -864,7 +864,7 @@ discard block |
||
| 864 | 864 | sprintf( |
| 865 | 865 | 'Invalid $connection argument of type %s given%s.', |
| 866 | 866 | is_object($connection) ? get_class($connection) : gettype($connection), |
| 867 | - is_object($connection) ? '' : ': "' . $connection . '"' |
|
| 867 | + is_object($connection) ? '' : ': "'.$connection.'"' |
|
| 868 | 868 | ) |
| 869 | 869 | ); |
| 870 | 870 | } |
@@ -667,7 +667,7 @@ discard block |
||
| 667 | 667 | /** |
| 668 | 668 | * Gets the ReflectionProperties of the mapped class. |
| 669 | 669 | * |
| 670 | - * @return array An array of ReflectionProperty instances. |
|
| 670 | + * @return \ReflectionProperty[] An array of ReflectionProperty instances. |
|
| 671 | 671 | */ |
| 672 | 672 | public function getReflectionProperties() |
| 673 | 673 | { |
@@ -805,7 +805,7 @@ discard block |
||
| 805 | 805 | * - reflClass (ReflectionClass) |
| 806 | 806 | * - reflFields (ReflectionProperty array) |
| 807 | 807 | * |
| 808 | - * @return array The names of all the fields that should be serialized. |
|
| 808 | + * @return string[] The names of all the fields that should be serialized. |
|
| 809 | 809 | */ |
| 810 | 810 | public function __sleep() |
| 811 | 811 | { |
@@ -1825,7 +1825,7 @@ discard block |
||
| 1825 | 1825 | * Sets the mapped identifier/primary key fields of this class. |
| 1826 | 1826 | * Mainly used by the ClassMetadataFactory to assign inherited identifiers. |
| 1827 | 1827 | * |
| 1828 | - * @param array $identifier |
|
| 1828 | + * @param string[] $identifier |
|
| 1829 | 1829 | * |
| 1830 | 1830 | * @return void |
| 1831 | 1831 | */ |
@@ -1854,7 +1854,7 @@ discard block |
||
| 1854 | 1854 | /** |
| 1855 | 1855 | * Gets an array containing all the column names. |
| 1856 | 1856 | * |
| 1857 | - * @param array|null $fieldNames |
|
| 1857 | + * @param string[] $fieldNames |
|
| 1858 | 1858 | * |
| 1859 | 1859 | * @return array |
| 1860 | 1860 | */ |
@@ -2012,7 +2012,7 @@ discard block |
||
| 2012 | 2012 | * |
| 2013 | 2013 | * @param string $fieldName |
| 2014 | 2014 | * |
| 2015 | - * @return \Doctrine\DBAL\Types\Type|string|null |
|
| 2015 | + * @return string |
|
| 2016 | 2016 | * |
| 2017 | 2017 | * @todo 3.0 Remove this. PersisterHelper should fix it somehow |
| 2018 | 2018 | */ |
@@ -2072,7 +2072,7 @@ discard block |
||
| 2072 | 2072 | /** |
| 2073 | 2073 | * Sets the mapped subclasses of this class. |
| 2074 | 2074 | * |
| 2075 | - * @param array $subclasses The names of all mapped subclasses. |
|
| 2075 | + * @param string[] $subclasses The names of all mapped subclasses. |
|
| 2076 | 2076 | * |
| 2077 | 2077 | * @return void |
| 2078 | 2078 | */ |
@@ -2088,7 +2088,7 @@ discard block |
||
| 2088 | 2088 | * Assumes that the class names in the passed array are in the order: |
| 2089 | 2089 | * directParent -> directParentParent -> directParentParentParent ... -> root. |
| 2090 | 2090 | * |
| 2091 | - * @param array $classNames |
|
| 2091 | + * @param string[] $classNames |
|
| 2092 | 2092 | * |
| 2093 | 2093 | * @return void |
| 2094 | 2094 | */ |
@@ -2625,7 +2625,7 @@ discard block |
||
| 2625 | 2625 | * @deprecated Deprecated since version 2.4 in favor of \Doctrine\ORM\Event\ListenersInvoker |
| 2626 | 2626 | * |
| 2627 | 2627 | * @param string $lifecycleEvent The lifecycle event. |
| 2628 | - * @param object $entity The Entity on which the event occurred. |
|
| 2628 | + * @param \Doctrine\Tests\ORM\Functional\Ticket\DDC1707Child $entity The Entity on which the event occurred. |
|
| 2629 | 2629 | * |
| 2630 | 2630 | * @return void |
| 2631 | 2631 | */ |
@@ -1428,7 +1428,7 @@ |
||
| 1428 | 1428 | |
| 1429 | 1429 | if (Type::hasType($mapping['type']) && Type::getType($mapping['type'])->canRequireSQLConversion()) { |
| 1430 | 1430 | if (isset($mapping['id']) && true === $mapping['id']) { |
| 1431 | - throw MappingException::sqlConversionNotAllowedForIdentifiers($this->name, $mapping['fieldName'], $mapping['type']); |
|
| 1431 | + throw MappingException::sqlConversionNotAllowedForIdentifiers($this->name, $mapping['fieldName'], $mapping['type']); |
|
| 1432 | 1432 | } |
| 1433 | 1433 | |
| 1434 | 1434 | $mapping['requireSQLConversion'] = true; |
@@ -696,7 +696,7 @@ discard block |
||
| 696 | 696 | public function getSingleIdReflectionProperty() |
| 697 | 697 | { |
| 698 | 698 | if ($this->isIdentifierComposite) { |
| 699 | - throw new BadMethodCallException("Class " . $this->name . " has a composite identifier."); |
|
| 699 | + throw new BadMethodCallException("Class ".$this->name." has a composite identifier."); |
|
| 700 | 700 | } |
| 701 | 701 | |
| 702 | 702 | return $this->reflFields[$this->identifier[0]]; |
@@ -791,7 +791,7 @@ discard block |
||
| 791 | 791 | */ |
| 792 | 792 | public function __toString() |
| 793 | 793 | { |
| 794 | - return __CLASS__ . '@' . spl_object_hash($this); |
|
| 794 | + return __CLASS__.'@'.spl_object_hash($this); |
|
| 795 | 795 | } |
| 796 | 796 | |
| 797 | 797 | /** |
@@ -1025,7 +1025,7 @@ discard block |
||
| 1025 | 1025 | public function validateAssociations() |
| 1026 | 1026 | { |
| 1027 | 1027 | foreach ($this->associationMappings as $mapping) { |
| 1028 | - if ( ! ClassLoader::classExists($mapping['targetEntity']) ) { |
|
| 1028 | + if ( ! ClassLoader::classExists($mapping['targetEntity'])) { |
|
| 1029 | 1029 | throw MappingException::invalidTargetEntityClass($mapping['targetEntity'], $this->name, $mapping['fieldName']); |
| 1030 | 1030 | } |
| 1031 | 1031 | } |
@@ -1103,7 +1103,7 @@ discard block |
||
| 1103 | 1103 | } |
| 1104 | 1104 | |
| 1105 | 1105 | if ( ! isset($cache['region'])) { |
| 1106 | - $cache['region'] = strtolower(str_replace('\\', '_', $this->rootEntityName)) . '__' . $fieldName; |
|
| 1106 | + $cache['region'] = strtolower(str_replace('\\', '_', $this->rootEntityName)).'__'.$fieldName; |
|
| 1107 | 1107 | } |
| 1108 | 1108 | |
| 1109 | 1109 | return $cache; |
@@ -1383,7 +1383,7 @@ discard block |
||
| 1383 | 1383 | protected function _validateAndCompleteFieldMapping(array &$mapping) |
| 1384 | 1384 | { |
| 1385 | 1385 | // Check mandatory fields |
| 1386 | - if ( ! isset($mapping['fieldName']) || !$mapping['fieldName']) { |
|
| 1386 | + if ( ! isset($mapping['fieldName']) || ! $mapping['fieldName']) { |
|
| 1387 | 1387 | throw MappingException::missingFieldName($this->name); |
| 1388 | 1388 | } |
| 1389 | 1389 | |
@@ -1496,14 +1496,14 @@ discard block |
||
| 1496 | 1496 | $this->isIdentifierComposite = true; |
| 1497 | 1497 | } |
| 1498 | 1498 | |
| 1499 | - if ($this->cache && !isset($mapping['cache'])) { |
|
| 1499 | + if ($this->cache && ! isset($mapping['cache'])) { |
|
| 1500 | 1500 | throw CacheException::nonCacheableEntityAssociation($this->name, $mapping['fieldName']); |
| 1501 | 1501 | } |
| 1502 | 1502 | } |
| 1503 | 1503 | |
| 1504 | 1504 | // Mandatory attributes for both sides |
| 1505 | 1505 | // Mandatory: fieldName, targetEntity |
| 1506 | - if ( ! isset($mapping['fieldName']) || !$mapping['fieldName']) { |
|
| 1506 | + if ( ! isset($mapping['fieldName']) || ! $mapping['fieldName']) { |
|
| 1507 | 1507 | throw MappingException::missingFieldName($this->name); |
| 1508 | 1508 | } |
| 1509 | 1509 | |
@@ -1625,7 +1625,7 @@ discard block |
||
| 1625 | 1625 | throw new RuntimeException("ClassMetadataInfo::setTable() has to be called before defining a one to one relationship."); |
| 1626 | 1626 | } |
| 1627 | 1627 | |
| 1628 | - $this->table['uniqueConstraints'][$mapping['fieldName'] . "_uniq"] = [ |
|
| 1628 | + $this->table['uniqueConstraints'][$mapping['fieldName']."_uniq"] = [ |
|
| 1629 | 1629 | 'columns' => $uniqueConstraintColumns |
| 1630 | 1630 | ]; |
| 1631 | 1631 | } |
@@ -1640,7 +1640,7 @@ discard block |
||
| 1640 | 1640 | unset($mapping['unique']); |
| 1641 | 1641 | } |
| 1642 | 1642 | |
| 1643 | - if (isset($mapping['id']) && $mapping['id'] === true && !$mapping['isOwningSide']) { |
|
| 1643 | + if (isset($mapping['id']) && $mapping['id'] === true && ! $mapping['isOwningSide']) { |
|
| 1644 | 1644 | throw MappingException::illegalInverseIdentifierAssociation($this->name, $mapping['fieldName']); |
| 1645 | 1645 | } |
| 1646 | 1646 | |
@@ -1694,7 +1694,7 @@ discard block |
||
| 1694 | 1694 | } |
| 1695 | 1695 | |
| 1696 | 1696 | $selfReferencingEntityWithoutJoinColumns = $mapping['sourceEntity'] == $mapping['targetEntity'] |
| 1697 | - && (! (isset($mapping['joinTable']['joinColumns']) || isset($mapping['joinTable']['inverseJoinColumns']))); |
|
| 1697 | + && ( ! (isset($mapping['joinTable']['joinColumns']) || isset($mapping['joinTable']['inverseJoinColumns']))); |
|
| 1698 | 1698 | |
| 1699 | 1699 | if ( ! isset($mapping['joinTable']['joinColumns'])) { |
| 1700 | 1700 | $mapping['joinTable']['joinColumns'] = [ |
@@ -1887,7 +1887,7 @@ discard block |
||
| 1887 | 1887 | |
| 1888 | 1888 | // Association defined as Id field |
| 1889 | 1889 | $joinColumns = $this->associationMappings[$idProperty]['joinColumns']; |
| 1890 | - $assocColumnNames = array_map(function ($joinColumn) { return $joinColumn['name']; }, $joinColumns); |
|
| 1890 | + $assocColumnNames = array_map(function($joinColumn) { return $joinColumn['name']; }, $joinColumns); |
|
| 1891 | 1891 | |
| 1892 | 1892 | $columnNames = array_merge($columnNames, $assocColumnNames); |
| 1893 | 1893 | } |
@@ -2068,7 +2068,7 @@ discard block |
||
| 2068 | 2068 | public function getTemporaryIdTableName() |
| 2069 | 2069 | { |
| 2070 | 2070 | // replace dots with underscores because PostgreSQL creates temporary tables in a special schema |
| 2071 | - return str_replace('.', '_', $this->getTableName() . '_id_tmp'); |
|
| 2071 | + return str_replace('.', '_', $this->getTableName().'_id_tmp'); |
|
| 2072 | 2072 | } |
| 2073 | 2073 | |
| 2074 | 2074 | /** |
@@ -2405,7 +2405,7 @@ discard block |
||
| 2405 | 2405 | */ |
| 2406 | 2406 | public function addNamedQuery(array $queryMapping) |
| 2407 | 2407 | { |
| 2408 | - if (!isset($queryMapping['name'])) { |
|
| 2408 | + if ( ! isset($queryMapping['name'])) { |
|
| 2409 | 2409 | throw MappingException::nameIsMandatoryForQueryMapping($this->name); |
| 2410 | 2410 | } |
| 2411 | 2411 | |
@@ -2413,7 +2413,7 @@ discard block |
||
| 2413 | 2413 | throw MappingException::duplicateQueryMapping($this->name, $queryMapping['name']); |
| 2414 | 2414 | } |
| 2415 | 2415 | |
| 2416 | - if (!isset($queryMapping['query'])) { |
|
| 2416 | + if ( ! isset($queryMapping['query'])) { |
|
| 2417 | 2417 | throw MappingException::emptyQueryMapping($this->name, $queryMapping['name']); |
| 2418 | 2418 | } |
| 2419 | 2419 | |
@@ -2440,7 +2440,7 @@ discard block |
||
| 2440 | 2440 | */ |
| 2441 | 2441 | public function addNamedNativeQuery(array $queryMapping) |
| 2442 | 2442 | { |
| 2443 | - if (!isset($queryMapping['name'])) { |
|
| 2443 | + if ( ! isset($queryMapping['name'])) { |
|
| 2444 | 2444 | throw MappingException::nameIsMandatoryForQueryMapping($this->name); |
| 2445 | 2445 | } |
| 2446 | 2446 | |
@@ -2448,11 +2448,11 @@ discard block |
||
| 2448 | 2448 | throw MappingException::duplicateQueryMapping($this->name, $queryMapping['name']); |
| 2449 | 2449 | } |
| 2450 | 2450 | |
| 2451 | - if (!isset($queryMapping['query'])) { |
|
| 2451 | + if ( ! isset($queryMapping['query'])) { |
|
| 2452 | 2452 | throw MappingException::emptyQueryMapping($this->name, $queryMapping['name']); |
| 2453 | 2453 | } |
| 2454 | 2454 | |
| 2455 | - if (!isset($queryMapping['resultClass']) && !isset($queryMapping['resultSetMapping'])) { |
|
| 2455 | + if ( ! isset($queryMapping['resultClass']) && ! isset($queryMapping['resultSetMapping'])) { |
|
| 2456 | 2456 | throw MappingException::missingQueryMapping($this->name, $queryMapping['name']); |
| 2457 | 2457 | } |
| 2458 | 2458 | |
@@ -2484,7 +2484,7 @@ discard block |
||
| 2484 | 2484 | */ |
| 2485 | 2485 | public function addSqlResultSetMapping(array $resultMapping) |
| 2486 | 2486 | { |
| 2487 | - if (!isset($resultMapping['name'])) { |
|
| 2487 | + if ( ! isset($resultMapping['name'])) { |
|
| 2488 | 2488 | throw MappingException::nameIsMandatoryForSqlResultSetMapping($this->name); |
| 2489 | 2489 | } |
| 2490 | 2490 | |
@@ -2494,7 +2494,7 @@ discard block |
||
| 2494 | 2494 | |
| 2495 | 2495 | if (isset($resultMapping['entities'])) { |
| 2496 | 2496 | foreach ($resultMapping['entities'] as $key => $entityResult) { |
| 2497 | - if (!isset($entityResult['entityClass'])) { |
|
| 2497 | + if ( ! isset($entityResult['entityClass'])) { |
|
| 2498 | 2498 | throw MappingException::missingResultSetMappingEntity($this->name, $resultMapping['name']); |
| 2499 | 2499 | } |
| 2500 | 2500 | |
@@ -2513,11 +2513,11 @@ discard block |
||
| 2513 | 2513 | |
| 2514 | 2514 | if (isset($entityResult['fields'])) { |
| 2515 | 2515 | foreach ($entityResult['fields'] as $k => $field) { |
| 2516 | - if (!isset($field['name'])) { |
|
| 2516 | + if ( ! isset($field['name'])) { |
|
| 2517 | 2517 | throw MappingException::missingResultSetMappingFieldName($this->name, $resultMapping['name']); |
| 2518 | 2518 | } |
| 2519 | 2519 | |
| 2520 | - if (!isset($field['column'])) { |
|
| 2520 | + if ( ! isset($field['column'])) { |
|
| 2521 | 2521 | $fieldName = $field['name']; |
| 2522 | 2522 | if (strpos($fieldName, '.')) { |
| 2523 | 2523 | list(, $fieldName) = explode('.', $fieldName); |
@@ -3008,7 +3008,7 @@ discard block |
||
| 3008 | 3008 | } |
| 3009 | 3009 | |
| 3010 | 3010 | if ($definition['sequenceName'][0] == '`') { |
| 3011 | - $definition['sequenceName'] = trim($definition['sequenceName'], '`'); |
|
| 3011 | + $definition['sequenceName'] = trim($definition['sequenceName'], '`'); |
|
| 3012 | 3012 | $definition['quoted'] = true; |
| 3013 | 3013 | } |
| 3014 | 3014 | |
@@ -3100,7 +3100,7 @@ discard block |
||
| 3100 | 3100 | public function getAssociationTargetClass($assocName) |
| 3101 | 3101 | { |
| 3102 | 3102 | if ( ! isset($this->associationMappings[$assocName])) { |
| 3103 | - throw new InvalidArgumentException("Association name expected, '" . $assocName ."' is not an association."); |
|
| 3103 | + throw new InvalidArgumentException("Association name expected, '".$assocName."' is not an association."); |
|
| 3104 | 3104 | } |
| 3105 | 3105 | |
| 3106 | 3106 | return $this->associationMappings[$assocName]['targetEntity']; |
@@ -3139,7 +3139,7 @@ discard block |
||
| 3139 | 3139 | // Association defined as Id field |
| 3140 | 3140 | $joinColumns = $this->associationMappings[$idProperty]['joinColumns']; |
| 3141 | 3141 | $assocQuotedColumnNames = array_map( |
| 3142 | - function ($joinColumn) use ($platform) { |
|
| 3142 | + function($joinColumn) use ($platform) { |
|
| 3143 | 3143 | return isset($joinColumn['quoted']) |
| 3144 | 3144 | ? $platform->quoteIdentifier($joinColumn['name']) |
| 3145 | 3145 | : $joinColumn['name']; |
@@ -3250,7 +3250,7 @@ discard block |
||
| 3250 | 3250 | } |
| 3251 | 3251 | |
| 3252 | 3252 | if ($className !== null && strpos($className, '\\') === false && $this->namespace) { |
| 3253 | - return $this->namespace . '\\' . $className; |
|
| 3253 | + return $this->namespace.'\\'.$className; |
|
| 3254 | 3254 | } |
| 3255 | 3255 | |
| 3256 | 3256 | return $className; |
@@ -3302,13 +3302,13 @@ discard block |
||
| 3302 | 3302 | foreach ($embeddable->fieldMappings as $fieldMapping) { |
| 3303 | 3303 | $fieldMapping['originalClass'] = $fieldMapping['originalClass'] ?? $embeddable->name; |
| 3304 | 3304 | $fieldMapping['declaredField'] = isset($fieldMapping['declaredField']) |
| 3305 | - ? $property . '.' . $fieldMapping['declaredField'] |
|
| 3305 | + ? $property.'.'.$fieldMapping['declaredField'] |
|
| 3306 | 3306 | : $property; |
| 3307 | 3307 | $fieldMapping['originalField'] = $fieldMapping['originalField'] ?? $fieldMapping['fieldName']; |
| 3308 | - $fieldMapping['fieldName'] = $property . "." . $fieldMapping['fieldName']; |
|
| 3308 | + $fieldMapping['fieldName'] = $property.".".$fieldMapping['fieldName']; |
|
| 3309 | 3309 | |
| 3310 | - if (! empty($this->embeddedClasses[$property]['columnPrefix'])) { |
|
| 3311 | - $fieldMapping['columnName'] = $this->embeddedClasses[$property]['columnPrefix'] . $fieldMapping['columnName']; |
|
| 3310 | + if ( ! empty($this->embeddedClasses[$property]['columnPrefix'])) { |
|
| 3311 | + $fieldMapping['columnName'] = $this->embeddedClasses[$property]['columnPrefix'].$fieldMapping['columnName']; |
|
| 3312 | 3312 | } elseif ($this->embeddedClasses[$property]['columnPrefix'] !== false) { |
| 3313 | 3313 | $fieldMapping['columnName'] = $this->namingStrategy |
| 3314 | 3314 | ->embeddedFieldToColumnName( |
@@ -3349,7 +3349,7 @@ discard block |
||
| 3349 | 3349 | { |
| 3350 | 3350 | $sequencePrefix = $this->getSequencePrefix($platform); |
| 3351 | 3351 | $columnName = $this->getSingleIdentifierColumnName(); |
| 3352 | - $sequenceName = $sequencePrefix . '_' . $columnName . '_seq'; |
|
| 3352 | + $sequenceName = $sequencePrefix.'_'.$columnName.'_seq'; |
|
| 3353 | 3353 | |
| 3354 | 3354 | return $sequenceName; |
| 3355 | 3355 | } |
@@ -3369,10 +3369,10 @@ discard block |
||
| 3369 | 3369 | |
| 3370 | 3370 | // Prepend the schema name to the table name if there is one |
| 3371 | 3371 | if ($schemaName = $this->getSchemaName()) { |
| 3372 | - $sequencePrefix = $schemaName . '.' . $tableName; |
|
| 3372 | + $sequencePrefix = $schemaName.'.'.$tableName; |
|
| 3373 | 3373 | |
| 3374 | 3374 | if ( ! $platform->supportsSchemas() && $platform->canEmulateSchemas()) { |
| 3375 | - $sequencePrefix = $schemaName . '__' . $tableName; |
|
| 3375 | + $sequencePrefix = $schemaName.'__'.$tableName; |
|
| 3376 | 3376 | } |
| 3377 | 3377 | } |
| 3378 | 3378 | |
@@ -3384,8 +3384,8 @@ discard block |
||
| 3384 | 3384 | */ |
| 3385 | 3385 | private function assertMappingOrderBy(array $mapping) |
| 3386 | 3386 | { |
| 3387 | - if (isset($mapping['orderBy']) && !is_array($mapping['orderBy'])) { |
|
| 3388 | - throw new InvalidArgumentException("'orderBy' is expected to be an array, not " . gettype($mapping['orderBy'])); |
|
| 3387 | + if (isset($mapping['orderBy']) && ! is_array($mapping['orderBy'])) { |
|
| 3388 | + throw new InvalidArgumentException("'orderBy' is expected to be an array, not ".gettype($mapping['orderBy'])); |
|
| 3389 | 3389 | } |
| 3390 | 3390 | } |
| 3391 | 3391 | } |
@@ -148,6 +148,9 @@ discard block |
||
| 148 | 148 | ); |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | + /** |
|
| 152 | + * @param string $dql |
|
| 153 | + */ |
|
| 151 | 154 | protected function asyncDqlWithLock($dql, $params, $lockMode) |
| 152 | 155 | { |
| 153 | 156 | $this->startJob('dqlWithLock', [ |
@@ -168,6 +171,9 @@ discard block |
||
| 168 | 171 | ); |
| 169 | 172 | } |
| 170 | 173 | |
| 174 | + /** |
|
| 175 | + * @param string $fn |
|
| 176 | + */ |
|
| 171 | 177 | protected function startJob($fn, $fixture) |
| 172 | 178 | { |
| 173 | 179 | $this->gearman->addTask($fn, serialize( |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | |
| 18 | 18 | protected function setUp() |
| 19 | 19 | { |
| 20 | - if (!class_exists('GearmanClient', false)) { |
|
| 20 | + if ( ! class_exists('GearmanClient', false)) { |
|
| 21 | 21 | $this->markTestSkipped('pecl/gearman is required for this test to run.'); |
| 22 | 22 | } |
| 23 | 23 | |
@@ -133,11 +133,11 @@ discard block |
||
| 133 | 133 | $this->gearman->runTasks(); |
| 134 | 134 | |
| 135 | 135 | $this->assertTrue($this->maxRunTime > $forTime, |
| 136 | - "Because of locking this tests should have run at least " . $forTime . " seconds, ". |
|
| 137 | - "but only did for " . $this->maxRunTime . " seconds."); |
|
| 136 | + "Because of locking this tests should have run at least ".$forTime." seconds, ". |
|
| 137 | + "but only did for ".$this->maxRunTime." seconds."); |
|
| 138 | 138 | $this->assertTrue($this->maxRunTime < $notLongerThan, |
| 139 | - "The longest task should not run longer than " . $notLongerThan . " seconds, ". |
|
| 140 | - "but did for " . $this->maxRunTime . " seconds." |
|
| 139 | + "The longest task should not run longer than ".$notLongerThan." seconds, ". |
|
| 140 | + "but did for ".$this->maxRunTime." seconds." |
|
| 141 | 141 | ); |
| 142 | 142 | } |
| 143 | 143 | |
@@ -176,6 +176,9 @@ discard block |
||
| 176 | 176 | $this->assertFalse($em->getFilters()->isEnabled("foo_filter")); |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | + /** |
|
| 180 | + * @param EntityManager $em |
|
| 181 | + */ |
|
| 179 | 182 | protected function configureFilters($em) |
| 180 | 183 | { |
| 181 | 184 | // Add filters to the configuration of the EM |
@@ -889,6 +892,9 @@ discard block |
||
| 889 | 892 | $this->assertEquals(2, count($manager->managedContracts->slice(0, 10))); |
| 890 | 893 | } |
| 891 | 894 | |
| 895 | + /** |
|
| 896 | + * @param string $name |
|
| 897 | + */ |
|
| 892 | 898 | private function usePersonNameFilter($name) |
| 893 | 899 | { |
| 894 | 900 | // Enable the filter |
@@ -568,11 +568,11 @@ discard block |
||
| 568 | 568 | $user = $this->_em->find(CmsUser::class, $this->userId); |
| 569 | 569 | |
| 570 | 570 | $this->assertFalse($user->articles->isInitialized()); |
| 571 | - $this->assertEquals(2, count($user->articles->slice(0,10))); |
|
| 571 | + $this->assertEquals(2, count($user->articles->slice(0, 10))); |
|
| 572 | 572 | |
| 573 | 573 | $this->useCMSArticleTopicFilter(); |
| 574 | 574 | |
| 575 | - $this->assertEquals(1, count($user->articles->slice(0,10))); |
|
| 575 | + $this->assertEquals(1, count($user->articles->slice(0, 10))); |
|
| 576 | 576 | } |
| 577 | 577 | |
| 578 | 578 | private function useCMSGroupPrefixFilter() |
@@ -616,11 +616,11 @@ discard block |
||
| 616 | 616 | $user = $this->_em->find(CmsUser::class, $this->userId2); |
| 617 | 617 | |
| 618 | 618 | $this->assertFalse($user->groups->isInitialized()); |
| 619 | - $this->assertEquals(2, count($user->groups->slice(0,10))); |
|
| 619 | + $this->assertEquals(2, count($user->groups->slice(0, 10))); |
|
| 620 | 620 | |
| 621 | 621 | $this->useCMSGroupPrefixFilter(); |
| 622 | 622 | |
| 623 | - $this->assertEquals(1, count($user->groups->slice(0,10))); |
|
| 623 | + $this->assertEquals(1, count($user->groups->slice(0, 10))); |
|
| 624 | 624 | } |
| 625 | 625 | |
| 626 | 626 | private function loadFixtureData() |
@@ -1106,11 +1106,11 @@ discard block |
||
| 1106 | 1106 | { |
| 1107 | 1107 | public function addFilterConstraint(ClassMetadata $targetEntity, $targetTableAlias) |
| 1108 | 1108 | { |
| 1109 | - if (!in_array("LocaleAware", $targetEntity->reflClass->getInterfaceNames())) { |
|
| 1109 | + if ( ! in_array("LocaleAware", $targetEntity->reflClass->getInterfaceNames())) { |
|
| 1110 | 1110 | return ""; |
| 1111 | 1111 | } |
| 1112 | 1112 | |
| 1113 | - return $targetTableAlias.'.locale = ' . $this->getParameter('locale'); // getParam uses connection to quote the value. |
|
| 1113 | + return $targetTableAlias.'.locale = '.$this->getParameter('locale'); // getParam uses connection to quote the value. |
|
| 1114 | 1114 | } |
| 1115 | 1115 | } |
| 1116 | 1116 | |
@@ -1122,7 +1122,7 @@ discard block |
||
| 1122 | 1122 | return ""; |
| 1123 | 1123 | } |
| 1124 | 1124 | |
| 1125 | - return $targetTableAlias.'.country = ' . $this->getParameter('country'); // getParam uses connection to quote the value. |
|
| 1125 | + return $targetTableAlias.'.country = '.$this->getParameter('country'); // getParam uses connection to quote the value. |
|
| 1126 | 1126 | } |
| 1127 | 1127 | } |
| 1128 | 1128 | |
@@ -1134,7 +1134,7 @@ discard block |
||
| 1134 | 1134 | return ""; |
| 1135 | 1135 | } |
| 1136 | 1136 | |
| 1137 | - return $targetTableAlias.'.name LIKE ' . $this->getParameter('prefix'); // getParam uses connection to quote the value. |
|
| 1137 | + return $targetTableAlias.'.name LIKE '.$this->getParameter('prefix'); // getParam uses connection to quote the value. |
|
| 1138 | 1138 | } |
| 1139 | 1139 | } |
| 1140 | 1140 | |
@@ -1146,7 +1146,7 @@ discard block |
||
| 1146 | 1146 | return ""; |
| 1147 | 1147 | } |
| 1148 | 1148 | |
| 1149 | - return $targetTableAlias.'.topic = ' . $this->getParameter('topic'); // getParam uses connection to quote the value. |
|
| 1149 | + return $targetTableAlias.'.topic = '.$this->getParameter('topic'); // getParam uses connection to quote the value. |
|
| 1150 | 1150 | } |
| 1151 | 1151 | } |
| 1152 | 1152 | |
@@ -1158,7 +1158,7 @@ discard block |
||
| 1158 | 1158 | return ""; |
| 1159 | 1159 | } |
| 1160 | 1160 | |
| 1161 | - return $targetTableAlias.'.name LIKE ' . $this->getParameter('name'); |
|
| 1161 | + return $targetTableAlias.'.name LIKE '.$this->getParameter('name'); |
|
| 1162 | 1162 | } |
| 1163 | 1163 | } |
| 1164 | 1164 | |
@@ -1170,7 +1170,7 @@ discard block |
||
| 1170 | 1170 | return ""; |
| 1171 | 1171 | } |
| 1172 | 1172 | |
| 1173 | - return $targetTableAlias.'.completed = ' . $this->getParameter('completed'); |
|
| 1173 | + return $targetTableAlias.'.completed = '.$this->getParameter('completed'); |
|
| 1174 | 1174 | } |
| 1175 | 1175 | } |
| 1176 | 1176 | |
@@ -1182,6 +1182,6 @@ discard block |
||
| 1182 | 1182 | return ""; |
| 1183 | 1183 | } |
| 1184 | 1184 | |
| 1185 | - return $targetTableAlias.'.id = ' . $this->getParameter('id'); |
|
| 1185 | + return $targetTableAlias.'.id = '.$this->getParameter('id'); |
|
| 1186 | 1186 | } |
| 1187 | 1187 | } |
@@ -5,8 +5,8 @@ discard block |
||
| 5 | 5 | |
| 6 | 6 | // Path to composer autoloader. You can use different provided by your favorite framework, |
| 7 | 7 | // if you want to. |
| 8 | -$loaderPath = __DIR__ . '/../../vendor/autoload.php'; |
|
| 9 | -if(!is_readable($loaderPath)){ |
|
| 8 | +$loaderPath = __DIR__.'/../../vendor/autoload.php'; |
|
| 9 | +if ( ! is_readable($loaderPath)) { |
|
| 10 | 10 | throw new LogicException('Run php composer.phar install at first'); |
| 11 | 11 | } |
| 12 | 12 | $loader = require $loaderPath; |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | $config = new \Doctrine\ORM\Configuration(); |
| 20 | 20 | |
| 21 | 21 | // Set up Metadata Drivers |
| 22 | -$driverImpl = $config->newDefaultAnnotationDriver([__DIR__ . "/Entities"]); |
|
| 22 | +$driverImpl = $config->newDefaultAnnotationDriver([__DIR__."/Entities"]); |
|
| 23 | 23 | $config->setMetadataDriverImpl($driverImpl); |
| 24 | 24 | |
| 25 | 25 | // Set up caches, depending on $debug variable. |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | $config->setQueryCacheImpl($cache); |
| 30 | 30 | |
| 31 | 31 | // Proxy configuration |
| 32 | -$config->setProxyDir(__DIR__ . '/Proxies'); |
|
| 32 | +$config->setProxyDir(__DIR__.'/Proxies'); |
|
| 33 | 33 | $config->setProxyNamespace('Proxies'); |
| 34 | 34 | |
| 35 | 35 | // Database connection information |