Skip to content

use doctrine 2.6 #1588

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 21, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"behat/symfony2-extension": "^2.1.1",
"behatch/contexts": "dev-master",
"doctrine/doctrine-bundle": "^1.6.3",
"doctrine/orm": ">=2.5.2 <2.6",
"doctrine/orm": "^2.5.2",
"doctrine/annotations": "^1.2",
"friendsofsymfony/user-bundle": "^2.0",
"guzzlehttp/guzzle": "^6.0",
Expand Down
9 changes: 9 additions & 0 deletions features/bootstrap/FeatureContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,7 @@ public function thereIsACompositeIdentifierObject()
$item = new CompositeItem();
$item->setField1('foobar');
$this->manager->persist($item);
$this->manager->flush();

for ($i = 0; $i < 4; ++$i) {
$label = new CompositeLabel();
Expand All @@ -571,6 +572,8 @@ public function thereIsACompositeIdentifierObject()
$rel->setValue('somefoobardummy');

$this->manager->persist($label);
// since doctrine 2.6 we need existing identifiers on relations
$this->manager->flush();
$this->manager->persist($rel);
}

Expand Down Expand Up @@ -623,12 +626,16 @@ public function thereIsARelatedDummyWithFriends(int $nb)
$relatedDummy = new RelatedDummy();
$relatedDummy->setName('RelatedDummy with friends');
$this->manager->persist($relatedDummy);
$this->manager->flush();

for ($i = 1; $i <= $nb; ++$i) {
$friend = new DummyFriend();
$friend->setName('Friend-'.$i);

$this->manager->persist($friend);
// since doctrine 2.6 we need existing identifiers on relations
// See https://github.com/doctrine/doctrine2/pull/6701
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh nice, you made my day! It's the solution to my problem on another project!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:) happy xmas

$this->manager->flush();

$relation = new RelatedToDummyFriend();
$relation->setName('Relation-'.$i);
Expand Down Expand Up @@ -740,6 +747,8 @@ public function createPeopleWithPets()

$this->manager->persist($person);
$this->manager->persist($pet);
// since doctrine 2.6 we need existing identifiers on relations
$this->manager->flush();
$this->manager->persist($personToPet);

$person->pets->add($personToPet);
Expand Down