php - Class Not Exist when loading entity Symfony 2 -
i create bundle , entity inside bundle. when try entity or repository in controller using entity manager give error class not exist.
i try debug using php app/console doctrine:mapping:info
it prompts every thing correct. output
found 4 mapped entities: [ok] bitcoin\mybundle\entity\productcategory [ok] bitcoin\mybundle\entity\adminuser [ok] bitcoin\mybundle\entity\product [ok] bitcoin\mybundle\entity\user
my controller code follows
<?php namespace bitcoin\mybundle\controller; use symfony\component\httpfoundation\request; use symfony\component\security\core\securitycontext; use symfony\bundle\frameworkbundle\controller\controller; use sensio\bundle\frameworkextrabundle\configuration\route; use sensio\bundle\frameworkextrabundle\configuration\template; use sensio\bundle\frameworkextrabundle\configuration\security; use bitcoin\adminbundle\form\login; use bitcoin\adminbundle\form\loginvalidate; class logincontroller extends controller { public function loginaction(request $request) { $user = $this->getdoctrine()->getrepository('user'); echo '<pre>'; prin_r(get_class_methods(get_class($user))); die; $pagedata = array( 'name' => 'login', ); return $this->render('bitcoinadminbundle:login:login.html.twig', $pagedata); }
}
when access in browser output :-
i worked zend framework new in symfony2. appreciate.
i find issue , silly mistake.
for repository should have use bundle name class name this
$user = $this->getdoctrine()->getrepository('bitcoinmybundle:user');
Comments
Post a Comment