I'm configuring my mock/dev data with Nelmio's Alice, so far so good.
I'm using hautelook's AliceBundle to get a nice integration with Symfony 3.1.
The problem I'm having is the one that follows:
I have a set of data is automatically generated and inserted in the Database by an external task, in one of the Doctrine Objects I need to reference one of those. I've already created the proper Doctrine Entity mapping the fields and the primary key but I can't figure how to reference one of those objects from my students.yml
.
I've tried the following:
AppBundle\Entity\Student:
clientApp1:
name: George
class: 3
age: 20
active: true
groups: [1, 3]
Being groups 1
and 3
groups that the task has already inserted in the database.
I get the following error whenever I try to load my fixtures into the database:
~>bin/console hautelook_alice:doctrine:fixtures:load
[Hautelook\AliceBundle\Alice\DataFixtures\LoadingLimitException]
Loading files limit of 5 reached. Could not load the following files:
/home/user/App/src/AppBundle/DataFixtures/ORM/dev/students.yml:
- Entity with Id 1 and Class AppBundle\Entity\Group not found
I have just one file so the first part of the error makes no sense, I think it's more of a typo by their reporting system, but the second part is the one that bugs me... The primary key (Id) is correct but it does not find it.
I've been looking at the documentation but I've seen nothing related, any thoughts?
EDIT: I just realize that the command does purge the database so it becomes impossible for Alice to find Group 1 nor Group 2. I'll try to workaround it and see if the command can be executed without the purging...
hautelook_alice:doctrine:fixtures:load
command purges the database, so, if you want to reference in your fixtures existed entity from database, you should append your fixtures. Flag --append
do all the work.
$ bin/console hautelook_alice:doctrine:fixtures:load --append