|
@@ 209-247 (lines=39) @@
|
| 206 |
|
self::assertEquals("DoctrineGlobal_User", $cm->getProperty('author')->getTargetEntity()); |
| 207 |
|
} |
| 208 |
|
|
| 209 |
|
public function testMapManyToManyJoinTableDefaults() |
| 210 |
|
{ |
| 211 |
|
$cm = new ClassMetadata(CMS\CmsUser::class, $this->metadataBuildingContext); |
| 212 |
|
$cm->initializeReflection(new RuntimeReflectionService()); |
| 213 |
|
|
| 214 |
|
$association = new Mapping\ManyToManyAssociationMetadata('groups'); |
| 215 |
|
|
| 216 |
|
$association->setTargetEntity(CMS\CmsGroup::class); |
| 217 |
|
|
| 218 |
|
$cm->addProperty($association); |
| 219 |
|
|
| 220 |
|
$association = $cm->getProperty('groups'); |
| 221 |
|
|
| 222 |
|
$joinColumns = []; |
| 223 |
|
|
| 224 |
|
$joinColumn = new Mapping\JoinColumnMetadata(); |
| 225 |
|
|
| 226 |
|
$joinColumn->setColumnName("cmsuser_id"); |
| 227 |
|
$joinColumn->setReferencedColumnName("id"); |
| 228 |
|
$joinColumn->setOnDelete("CASCADE"); |
| 229 |
|
|
| 230 |
|
$joinColumns[] = $joinColumn; |
| 231 |
|
|
| 232 |
|
$inverseJoinColumns = []; |
| 233 |
|
|
| 234 |
|
$joinColumn = new Mapping\JoinColumnMetadata(); |
| 235 |
|
|
| 236 |
|
$joinColumn->setColumnName("cmsgroup_id"); |
| 237 |
|
$joinColumn->setReferencedColumnName("id"); |
| 238 |
|
$joinColumn->setOnDelete("CASCADE"); |
| 239 |
|
|
| 240 |
|
$inverseJoinColumns[] = $joinColumn; |
| 241 |
|
|
| 242 |
|
$joinTable = $association->getJoinTable(); |
| 243 |
|
|
| 244 |
|
self::assertEquals('cmsuser_cmsgroup', $joinTable->getName()); |
| 245 |
|
self::assertEquals($joinColumns, $joinTable->getJoinColumns()); |
| 246 |
|
self::assertEquals($inverseJoinColumns, $joinTable->getInverseJoinColumns()); |
| 247 |
|
} |
| 248 |
|
|
| 249 |
|
public function testSerializeManyToManyJoinTableCascade() |
| 250 |
|
{ |
|
@@ 1360-1398 (lines=39) @@
|
| 1357 |
|
$cm->addEntityListener(Events::postLoad, 'Doctrine\Tests\Models\Company\CompanyContractListener', 'invalidMethod'); |
| 1358 |
|
} |
| 1359 |
|
|
| 1360 |
|
public function testManyToManySelfReferencingNamingStrategyDefaults() |
| 1361 |
|
{ |
| 1362 |
|
$cm = new ClassMetadata(CustomTypeParent::class, $this->metadataBuildingContext); |
| 1363 |
|
$cm->initializeReflection(new RuntimeReflectionService()); |
| 1364 |
|
|
| 1365 |
|
$association = new Mapping\ManyToManyAssociationMetadata('friendsWithMe'); |
| 1366 |
|
|
| 1367 |
|
$association->setTargetEntity(CustomTypeParent::class); |
| 1368 |
|
|
| 1369 |
|
$cm->addProperty($association); |
| 1370 |
|
|
| 1371 |
|
$association = $cm->getProperty('friendsWithMe'); |
| 1372 |
|
|
| 1373 |
|
$joinColumns = []; |
| 1374 |
|
|
| 1375 |
|
$joinColumn = new Mapping\JoinColumnMetadata(); |
| 1376 |
|
|
| 1377 |
|
$joinColumn->setColumnName("customtypeparent_source"); |
| 1378 |
|
$joinColumn->setReferencedColumnName("id"); |
| 1379 |
|
$joinColumn->setOnDelete("CASCADE"); |
| 1380 |
|
|
| 1381 |
|
$joinColumns[] = $joinColumn; |
| 1382 |
|
|
| 1383 |
|
$inverseJoinColumns = []; |
| 1384 |
|
|
| 1385 |
|
$joinColumn = new Mapping\JoinColumnMetadata(); |
| 1386 |
|
|
| 1387 |
|
$joinColumn->setColumnName("customtypeparent_target"); |
| 1388 |
|
$joinColumn->setReferencedColumnName("id"); |
| 1389 |
|
$joinColumn->setOnDelete("CASCADE"); |
| 1390 |
|
|
| 1391 |
|
$inverseJoinColumns[] = $joinColumn; |
| 1392 |
|
|
| 1393 |
|
$joinTable = $association->getJoinTable(); |
| 1394 |
|
|
| 1395 |
|
self::assertEquals('customtypeparent_customtypeparent', $joinTable->getName()); |
| 1396 |
|
self::assertEquals($joinColumns, $joinTable->getJoinColumns()); |
| 1397 |
|
self::assertEquals($inverseJoinColumns, $joinTable->getInverseJoinColumns()); |
| 1398 |
|
} |
| 1399 |
|
|
| 1400 |
|
/** |
| 1401 |
|
* @group DDC-2662 |