|
@@ 746-761 (lines=16) @@
|
| 743 |
|
/** |
| 744 |
|
* @group DDC-117 |
| 745 |
|
*/ |
| 746 |
|
public function testOrphanRemovalIdentifierAssociation() |
| 747 |
|
{ |
| 748 |
|
$cm = new ClassMetadata(DDC117ArticleDetails::class, $this->metadataBuildingContext); |
| 749 |
|
$cm->setTable(new Mapping\TableMetadata("ddc117_article_details")); |
| 750 |
|
|
| 751 |
|
$this->expectException(MappingException::class); |
| 752 |
|
$this->expectExceptionMessage('The orphan removal option is not allowed on an association that'); |
| 753 |
|
|
| 754 |
|
$association = new Mapping\OneToOneAssociationMetadata('article'); |
| 755 |
|
|
| 756 |
|
$association->setTargetEntity(DDC117Article::class); |
| 757 |
|
$association->setPrimaryKey(true); |
| 758 |
|
$association->setOrphanRemoval(true); |
| 759 |
|
|
| 760 |
|
$cm->addProperty($association); |
| 761 |
|
} |
| 762 |
|
|
| 763 |
|
/** |
| 764 |
|
* @group DDC-117 |
|
@@ 766-781 (lines=16) @@
|
| 763 |
|
/** |
| 764 |
|
* @group DDC-117 |
| 765 |
|
*/ |
| 766 |
|
public function testInverseIdentifierAssociation() |
| 767 |
|
{ |
| 768 |
|
$cm = new ClassMetadata(DDC117ArticleDetails::class, $this->metadataBuildingContext); |
| 769 |
|
$cm->setTable(new Mapping\TableMetadata("ddc117_article_details")); |
| 770 |
|
|
| 771 |
|
$this->expectException(MappingException::class); |
| 772 |
|
$this->expectExceptionMessage('An inverse association is not allowed to be identifier in'); |
| 773 |
|
|
| 774 |
|
$association = new Mapping\OneToOneAssociationMetadata('article'); |
| 775 |
|
|
| 776 |
|
$association->setTargetEntity(DDC117Article::class); |
| 777 |
|
$association->setPrimaryKey(true); |
| 778 |
|
$association->setMappedBy('details'); |
| 779 |
|
|
| 780 |
|
$cm->addProperty($association); |
| 781 |
|
} |
| 782 |
|
|
| 783 |
|
/** |
| 784 |
|
* @group DDC-117 |
|
@@ 786-800 (lines=15) @@
|
| 783 |
|
/** |
| 784 |
|
* @group DDC-117 |
| 785 |
|
*/ |
| 786 |
|
public function testIdentifierAssociationManyToMany() |
| 787 |
|
{ |
| 788 |
|
$cm = new ClassMetadata(DDC117ArticleDetails::class, $this->metadataBuildingContext); |
| 789 |
|
$cm->setTable(new Mapping\TableMetadata("ddc117_article_details")); |
| 790 |
|
|
| 791 |
|
$this->expectException(MappingException::class); |
| 792 |
|
$this->expectExceptionMessage('Many-to-many or one-to-many associations are not allowed to be identifier in'); |
| 793 |
|
|
| 794 |
|
$association = new Mapping\ManyToManyAssociationMetadata('article'); |
| 795 |
|
|
| 796 |
|
$association->setTargetEntity(DDC117Article::class); |
| 797 |
|
$association->setPrimaryKey(true); |
| 798 |
|
|
| 799 |
|
$cm->addProperty($association); |
| 800 |
|
} |
| 801 |
|
|
| 802 |
|
/** |
| 803 |
|
* @group DDC-996 |