bonjour,

J'ai une erreur que je n'arrive pas à résoudre qd j'essaie de créer 2 tables à partir de mes entités :

Entité rubrique :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
<?php
 
namespace Msm\SiteBundle\Entity;
 
use Doctrine\ORM\Mapping as ORM;
 
/**
 * Msm\SiteBundle\Entity\Rubrique
 *
 * @ORM\Table()
 * @ORM\Entity(repositoryClass="Msm\SiteBundle\Entity\RubriqueRepository")
 */
class Rubrique
{
 
    /**
     * @var smallint $idrubrique
     *
     * @ORM\Column(name="idrubrique", type="smallint")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $idrubrique;
	/**
	 * @ManyToOne(targetEntity="Categorie")
	 *
	 */
    private $idcategorie;
 
    /**
     * @var string $nomrubrique
     *
     * @ORM\Column(name="nomrubrique", type="string", length=72)
     */
    private $nomrubrique;
 
    /**
     * Get id
     *
     * @return integer
     */
    public function getId()
    {
        return $this->id;
    }
 
    /**
     * Set idcategorie
     *
     * @param smallint $idcategorie
     */
    public function setIdcategorie($idcategorie)
    {
        $this->idcategorie = $idcategorie;
    }
 
    /**
     * Get idcategorie
     *
     * @return smallint
     */
    public function getIdcategorie()
    {
        return $this->idcategorie;
    }
 
    /**
     * Set nomrubrique
     *
     * @param string $nomrubrique
     */
    public function setNomrubrique($nomrubrique)
    {
        $this->nomrubrique = $nomrubrique;
    }
 
    /**
     * Get nomrubrique
     *
     * @return string
     */
    public function getNomrubrique()
    {
        return $this->nomrubrique;
    }
}
Entité categorie:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
 
<?php
 
namespace Msm\SiteBundle\Entity;
 
use Doctrine\ORM\Mapping as ORM;
 
/**
 * Msm\SiteBundle\Entity\Categorie
 *
 * @ORM\Table()
 * @ORM\Entity(repositoryClass="Msm\SiteBundle\Entity\CategorieRepository")
 */
class Categorie
{
     /**
     * @var smallint $idcategorie
     * @ORM\Id
     * @ORM\Column(name="idcategorie", type="smallint")
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $idcategorie;
 
    /**
     * @var string $nomcategorie
     *
     * @ORM\Column(name="nomcategorie", type="string", length=255)
     */
    private $nomcategorie;
 
    /**
     * Get id
     *
     * @return integer
     */
    public function getId()
    {
        return $this->id;
    }
 
    /**
     * Set idcategorie
     *
     * @param smallint $idcategorie
     */
    public function setIdcategorie($idcategorie)
    {
        $this->idcategorie = $idcategorie;
    }
 
    /**
     * Get idcategorie
     *
     * @return smallint
     */
    public function getIdcategorie()
    {
        return $this->idcategorie;
    }
 
    /**
     * Set nomcategorie
     *
     * @param string $nomcategorie
     */
    public function setNomcategorie($nomcategorie)
    {
        $this->nomcategorie = $nomcategorie;
    }
 
    /**
     * Get nomcategorie
     *
     * @return string
     */
    public function getNomcategorie()
    {
        return $this->nomcategorie;
    }
}
voila j'aimerais créer les tables Rubrique et Categorie avec dans la table rubrique une cle etrangere (idcategorie) correspondant à la cle primaire de Categorie (idcategorie) c'est pourquoi j'ai mis l'annotation :

@ManyToOne(targetEntity="Categorie") mais ça ne marche pas! et avec @ManyToOne(targetEntity="Msm\SiteBundle\Entity\Categorie") ça ne marche pas non plus.


Le message d'erreur est du genre : "l'annotation @ManyToOne n'a pas été importé..."

et aucune de mes tables n'est créée. Comment faire? Merci.