Problème avec une relation many-to-many
Voici le message d'erreur que j'ai lorsque j'essai d'accéder à ma page.
"[Semantical Error] The annotation "@JoinTable" in property Ecole\InfoBundle\Entity\Enfant::$interventions was never imported. Did you maybe forget to add a "use" statement for this annotation?"
Le code de mon entity enfant
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181
| <?php
namespace Ecole\InfoBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Ecole\InfoBundle\Entity\Enfant
*
* @ORM\Table()
* @ORM\Entity(repositoryClass="Ecole\InfoBundle\Entity\EnfantRepository")
*/
class Enfant
{
/**
* @var integer $id
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string $prenom
*
* @ORM\Column(name="prenom", type="string", length=255)
*/
private $prenom;
/**
* @var string $nom
*
* @ORM\Column(name="nom", type="string", length=255)
*/
private $nom;
/**
* @var date $dateNaissance
*
* @ORM\Column(name="dateNaissance", type="date")
*/
private $dateNaissance;
/**
* @ORM\ManyToOne(targetEntity="Repondant",cascade={"persist"})
*/
private $repondant;
/**
* @ORM\ManyToMany(targetEntity="Intervention",cascade={"persist"},inversedBy="enfants")
*
*
*/
private $interventions;
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set prenom
*
* @param string $prenom
*/
public function setPrenom($prenom)
{
$this->prenom = $prenom;
}
/**
* Get prenom
*
* @return string
*/
public function getPrenom()
{
return $this->prenom;
}
/**
* Set nom
*
* @param string $nom
*/
public function setNom($nom)
{
$this->nom = $nom;
}
/**
* Get nom
*
* @return string
*/
public function getNom()
{
return $this->nom;
}
/**
* Set dateNaissance
*
* @param date $dateNaissance
*/
public function setDateNaissance($dateNaissance)
{
$this->dateNaissance = $dateNaissance;
}
/**
* Get dateNaissance
*
* @return date
*/
public function getDateNaissance()
{
return $this->dateNaissance;
}
public function getPrenomNom()
{
return $this->prenom. ' '.$this->getNom();
}
/**
* Set repondant
*
* @param Ecole\InfoBundle\Entity\Repondant $repondant
*/
public function setRepondant(\Ecole\InfoBundle\Entity\Repondant $repondant)
{
$this->repondant = $repondant;
}
/**
* Get repondant
*
* @return Ecole\InfoBundle\Entity\Repondant
*/
public function getRepondant()
{
return $this->repondant;
}
public function __construct()
{
$this->interventions = new \Doctrine\Common\Collections\ArrayCollection();
}
/**
* Add interventions
*
* @param Ecole\InfoBundle\Entity\Intervention $interventions
*/
public function addIntervention(\Ecole\InfoBundle\Entity\Intervention $interventions)
{
$this->interventions[] = $interventions;
}
/**
* Get interventions
*
* @return Doctrine\Common\Collections\Collection
*/
public function getInterventions()
{
return $this->interventions;
}
} |
Maintenant la page intervention
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146
| <?php
namespace Ecole\InfoBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Ecole\InfoBundle\Entity\Intervention
*
* @ORM\Table()
* @ORM\Entity(repositoryClass="Ecole\InfoBundle\Entity\InterventionRepository")
*/
class Intervention
{
/**
* @var integer $id
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string $raison
*
* @ORM\Column(name="raison", type="string", length=555)
*/
private $raison;
/**
* @var string $commentaire
*
* @ORM\Column(name="commentaire", type="string", length=255)
*/
private $commentaire;
/**
* @var date $date
*
* @ORM\Column(name="date", type="date")
*/
private $date;
/**
* @ORM\ManyToMany(targetEntity="Enfant",cascade={"persist"}, mappedBy="enfants")
*/
private $enfants;
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set raison
*
* @param string $raison
*/
public function setRaison($raison)
{
$this->raison = $raison;
}
/**
* Get raison
*
* @return string
*/
public function getRaison()
{
return $this->raison;
}
/**
* Set commentaire
*
* @param string $commentaire
*/
public function setCommentaire($commentaire)
{
$this->commentaire = $commentaire;
}
/**
* Get commentaire
*
* @return string
*/
public function getCommentaire()
{
return $this->commentaire;
}
/**
* Set date
*
* @param date $date
*/
public function setDate($date)
{
$this->date = $date;
}
/**
* Get date
*
* @return date
*/
public function getDate()
{
return $this->date;
}
public function __construct()
{
$this->enfants = new \Doctrine\Common\Collections\ArrayCollection();
}
/**
* Add enfants
*
* @param Ecole\InfoBundle\Entity\Enfant $enfants
*/
public function addEnfant(\Ecole\InfoBundle\Entity\Enfant $enfants)
{
$this->enfants[] = $enfants;
}
/**
* Get enfants
*
* @return Doctrine\Common\Collections\Collection
*/
public function getEnfants()
{
return $this->enfants;
}
} |
Merci de votre aide