"Aufruf einer Mitgliedsfunktion hat () auf einem Nicht-Objekt" in Symfony 2 Controller
Ich erhalte einen Fehler
Fatal error: Call to a member function has() on a non-object in /labs/Projects/What2Do/vendor/symfony/src/Symfony/Bundle/FrameworkBundle/Controller/Controller.php on line 161
Bin mir nicht ganz sicher, wie ich das debuggen soll. Der Fehler liegt in einer Symfony 2-Datei vor, nicht in meiner. Mein Controller sieht wie folgt aus. Ich leite dieindexAction
<code><?php class ProjectsController extends Controller { /** * @var EntityManager */ protected $em; public function __construct() { $this->em = $this->getDoctrine()->getEntityManager(); } /** * @Route("/") * @Route("/projects", name="listProjects") * @Template() */ public function indexAction() { $projects = $this->em->getRepository(Project::NAME)->findAll(); return array('projects' => $projects); } /** * @Route("/projects/{projId}", name="viewProject") * @Template() */ public function viewAction($projId) { // retrieve project $proj = $this->em->getRepository(Project::NAME)->findOneById($projId); if ($proj == null) throw $this->createNotFoundException ('Invalid project'); return array('proj' => $proj); } } </code>