I am trying to create test data using the Alice Bundle fixtures in my Symfony2 project. So far I've been pretty successful. But now I am trying to create fixtures from two entities that depend on each other.
Here is my fixture definition for the entity "account":
Bundle\CoreBundle\Entity\Account:
account{1..10}:
isBadDebt: <numberBetween(1, 2)>
primaryOrganization: @organization<current()>
Now, here is my fixture definition for the entity "organization":
Bundle\CoreBundle\Entity\Organization:
organization (template):
organizationName: <company()>
firstName: <firstName()>
lastName: <lastName()>
billingLine1: <streetAddress()>
billingLine2: 15%? <secondaryAddress()>
billingCity: <city()>
billingState: <stateAbbr()>
billingZip: <postcode()>
organization{1..10} (extends organization):
account: @account<current()>
If I remove the line: primaryOrganization: @organization<current()>
from the account.yml file, everything works fine. 10 account fixtures are created, and 10 organization fixtures are created. The organizations are aware of the accounts because they have been defined. But if I try to set the primary organization in the account fixture, it complains because the organizations have not yet been defined.
Is there any way to get both fixtures to depend on each other?