I'm new to symfony, I have Two entities with a ManyToMany relationship. Action.php
and Etablissement.php
I'm trying to populate my database from two .csv files (one for each object) with doctrine fixtures.
I begin with EtablissementFixtures.php
in which i reference each Etablissement
$this->addReference($line[0], $etablissement);
so that i can access it in my other Fixture.
The problem is that in my second fixture ActionFixture.php
the .csv contains some id's that don't exist in the Etablissement
's .csv. When i try $this->getReference($line[0])
i get a Reference to "0010063N" does not exist error, i've tried to surround the getReference line with a try/catch block but it doesn't work, i want to ignore that error and continue the execution of the code.
I hope that i made it clear, thank you.
Welcome to the SO forums.
If I understood your question correctly, you are looking for hasReference function that you can use for checking whether a reference with specific name exists:
$this->hasReference($line[0]);