You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I just encountered a problem with referencing an object multiple times with different names before flushing. It seems only the first reference I make gets persisted and is available in following fixtures. Here is an example:
public function load(ObjectManager $manager)
{
$obj = new Obj();
$obj->setFoo('bar');
$manager->persist($obj);
$this->addReference('first-reference', $obj);
$this->addReference('second-reference', $obj);
$manager->flush();
}
When referencing "first-reference" in the following fixture I get the persisted object I expect. But if I reference "second-reference" I get an object that is in an unpersisted state. This is problematic if I want to relate the previously persisted object to another object in a following fixture by referencing "second-reference".
If I flush before adding the references, everything works fine. Is it a bug or an intended behaviour?
The text was updated successfully, but these errors were encountered:
Copied from doctrine/DoctrineFixturesBundle#57 by @deeky666
I just encountered a problem with referencing an object multiple times with different names before flushing. It seems only the first reference I make gets persisted and is available in following fixtures. Here is an example:
When referencing "first-reference" in the following fixture I get the persisted object I expect. But if I reference "second-reference" I get an object that is in an unpersisted state. This is problematic if I want to relate the previously persisted object to another object in a following fixture by referencing "second-reference".
If I flush before adding the references, everything works fine. Is it a bug or an intended behaviour?
The text was updated successfully, but these errors were encountered: