Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Referencing same object multiple times before flushing #57

Closed
deeky666 opened this Issue · 1 comment

3 participants

@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:

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?

@stof
Collaborator

Please report it to the DataFixtures library. This bundle only provides the command calling the library, not the fixture loading logic.

@lavoiesl lavoiesl closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.