Od niedawna bawię się z Symfony2 i mam problem z pobraniem nazwy autora postu. Jakos do tej pory nie mialem problemów

Kawałek entity Users:
Oraz Comments:
/** * @ORM\Entity * @ORM\Table(name="users") */ class Users { /** * @ORM\OneToMany(targetEntity="Comments", mappedBy="users") */ protected $comments; public function __construct() { $this->comments = new ArrayCollection(); } // ....
Wiem że to prymitywny kod ale czytając dokumentacje dowiedziałem się że tak moge pobrać moja nazwe usera. Więc w kontrolerze zrobilem taka funkcje:
/** * @ORM\Entity * @ORM\Table(name="comments") */ class Comments { /** * @ORM\ManyToOne(targetEntity="Users", inversedBy="users") * @ORM\JoinColumn(name="user_id", referencedColumnName="id") */ protected $users;
public function Username($id) { $name = $this->getDoctrine() ->getRepository('AcmeForumBundle:Comments') ->find($id); $username = $name->getUsers()->getName(); return $username; }
ale nic sie nie dzieje.W czym polega błąd?