@@ -560,6 +560,7 @@ public function thereIsACompositeIdentifierObject()
560
560
$ item = new CompositeItem ();
561
561
$ item ->setField1 ('foobar ' );
562
562
$ this ->manager ->persist ($ item );
563
+ $ this ->manager ->flush ();
563
564
564
565
for ($ i = 0 ; $ i < 4 ; ++$ i ) {
565
566
$ label = new CompositeLabel ();
@@ -571,6 +572,8 @@ public function thereIsACompositeIdentifierObject()
571
572
$ rel ->setValue ('somefoobardummy ' );
572
573
573
574
$ this ->manager ->persist ($ label );
575
+ // since doctrine 2.6 we need existing identifiers on relations
576
+ $ this ->manager ->flush ();
574
577
$ this ->manager ->persist ($ rel );
575
578
}
576
579
@@ -623,12 +626,16 @@ public function thereIsARelatedDummyWithFriends(int $nb)
623
626
$ relatedDummy = new RelatedDummy ();
624
627
$ relatedDummy ->setName ('RelatedDummy with friends ' );
625
628
$ this ->manager ->persist ($ relatedDummy );
629
+ $ this ->manager ->flush ();
626
630
627
631
for ($ i = 1 ; $ i <= $ nb ; ++$ i ) {
628
632
$ friend = new DummyFriend ();
629
633
$ friend ->setName ('Friend- ' .$ i );
630
634
631
635
$ this ->manager ->persist ($ friend );
636
+ // since doctrine 2.6 we need existing identifiers on relations
637
+ // See https://github.com/doctrine/doctrine2/pull/6701
638
+ $ this ->manager ->flush ();
632
639
633
640
$ relation = new RelatedToDummyFriend ();
634
641
$ relation ->setName ('Relation- ' .$ i );
@@ -740,6 +747,8 @@ public function createPeopleWithPets()
740
747
741
748
$ this ->manager ->persist ($ person );
742
749
$ this ->manager ->persist ($ pet );
750
+ // since doctrine 2.6 we need existing identifiers on relations
751
+ $ this ->manager ->flush ();
743
752
$ this ->manager ->persist ($ personToPet );
744
753
745
754
$ person ->pets ->add ($ personToPet );
0 commit comments