Bonjour, je vous demande de l'aide svp. Erreur:Neither the property "categorie" nor one of the methods "getCategorie()", "isCategorie()", "hasCategorie()", "__get()" exist and have public access in class "Sdz\ForumBundle\Entity\Categorie".
Voici ma classe 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
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
<?php
 
namespace Sdz\ForumBundle\Entity;
 
use Doctrine\Common\Collections\ArrayCollection;
use sdz\ForumBundle\Entity\ForumSujet;
use Doctrine\ORM\Mapping as ORM;
 
 
/**
 * Categorie
 *
 * 
 * @ORM\Entity(repositoryClass="Sdz\ForumBundle\Entity\CategorieRepository")
 */
class Categorie
{
 
    // ...
     /**
     * @var integer
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    protected $id;
 
     /**
     * @ORM\OneToMany(targetEntity="ForumSujet", mappedBy="categorie")
     */
    protected $forumsujets;
	/**
     * @ORM\Column(name="nom_categorie",type="string", length=50)
	 */
	protected $name;
 
	public function __construct()
    {
        $this->forumsujets = new ArrayCollection();
    }
 
    /**
     * Get id
     *
     * @return integer 
     */
    public function getId()
    {
        return $this->id;
    }
 
 
    /**
     * Add forumsujets
     *
     * @param \Sdz\ForumBundle\Entity\ForumSujet $forumsujets
     * @return Categorie
     */
    public function addForumsujet(\Sdz\ForumBundle\Entity\ForumSujet $forumsujets)
    {
        $this->forumsujets[] = $forumsujets;
 
        return $this;
    }
 
    /**
     * Remove forumsujets
     *
     * @param \Sdz\ForumBundle\Entity\ForumSujet $forumsujets
     */
    public function removeForumsujet(\Sdz\ForumBundle\Entity\ForumSujet $forumsujets)
    {
        $this->forumsujets->removeElement($forumsujets);
    }
 
    /**
     * Get forumsujets
     *
     * @return \Doctrine\Common\Collections\Collection 
     */
    public function getForumsujets()
    {
        return $this->forumsujets;
    }
 
    /**
     * Set name
     *
     * @param string $name
     * @return Categorie
     */
    public function setName($name)
    {
        $this->name = $name;
 
        return $this;
    }
 
    /**
     * Get name
     *
     * @return string 
     */
    public function getName()
    {
        return $this->name;
    }
}
Mon controller:
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
$a=new ForumSujet();
		$b=new Categorie();
		$c=new Sujet();
 
		$form=$this->createForm( new ForumSujetType(),$a);
		$form1=$this->createForm( new CategorieType(),$b);
		$form2=$this->createForm( new SujetType(),$c);
		if($request->isMethod('POST')){
		$form->handleRequest($request);
		if($form->isValid()){
		$a->upload();
		$em=$this->getDoctrine()->getEntityManager();
		$form->getData();
		$form1->getData();
		$form2->getData();
 
		$a->setUser("#########");
 
		$a->setSujet($c);
 
		$a->setCategorie($b);
 
 
			$em->persist($a);
			$em->persist($b);
			$em->persist($c);
			$em->flush();
Mon entité qui est mappé avec categorie:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
 /**
     * @ORM\ManyToOne(targetEntity="Categorie", inversedBy="forumsujet")
     * @ORM\JoinColumn(name="category_id", referencedColumnName="id")
     */
 
    private $categorie;
Merci pour toute suggestion.