3
votes

I have a site that uses both Doctrine Migrations and Fixtures successfully (awesome features!), however I am having a small issue.

I have added a table and a new foreign key field to that table in an existing entity. The migration populates the new table with its initial values.

In my fixture that loads data for the table with the foreign key, I need to set the field to one of the values created in the migration, but I can't seem to get any entities out of that repository.

Any ideas why that would be happening, or a suggestion as to how I should be doing this differently.

The fixture implements the ContainerAwareInterface so that I have access to the entities repository, but doing:

$repo = $this->container->get('doctrine')
    ->getRepository('myCoreBundle:StoryStatus');
$statuses = $repo->findAll();
print_r($statuses);

returns nothing, even though I can see there are values in the DB at this point.

1

1 Answers

0
votes

Figured it out. Bit of stupidity on my part. Loading the fixtures was clearing the database of course, so it would never find any entities :). Need to implement a fixture to create them again.