Problème d'insertion en base
Bonjour,
Voici mon problème, j'ai 2 tables :
1 pour les groupes d'attributs donc :
id, titre
1 autre pour les attributs :
id, groupe, titre
Lorsque j'exécute ce code par exemple :
Code:
1 2 3 4 5 6 7 8 9 10 11 12
|
$em = $this->getDoctrine()->getEntityManager();
$groupe_attribut = new GroupeAttribut('groupe1');
$em->persist($groupe_attribut);
$attributs = array('attr1', 'attr2', 'attr3');
foreach ($attributs as $str_attribut)
{
$attribut = new Attribut($str_attribut);
$attribut->setGroupe($groupe_attribut);
$em->persist($attribut);
}
$em->flush(); |
J'obtiens sans cesse l'erreur suivante :
Citation:
Notice: Undefined index: 00000000694d706900000000167ce092 in C:\SymfonyApp\vendor\doctrine\lib\Doctrine\ORM\UnitOfWork.php line 2152
Ceci est du au $attribut->setGroupe($groupe_attribut); car lorsque je commente cette ligne, ça fonctionne mais ne m'enregistre pas ma relation.
Quelqu'un aurait-il une idée ? ou m'y prends-je mal ?