Unknown Entity namespace alias in symfony2

Posted by Zoha Ali Khan on Stack Overflow See other posts from Stack Overflow or by Zoha Ali Khan
Published on 2012-06-16T23:21:57Z Indexed on 2012/06/17 9:16 UTC
Read the original article Hit count: 1341

Filed under:
|
|
|

Hey I have two bundles in my symfony2 project. one is Bundle and the other one is PatentBundle.

My app/config/route.yml file is

MunichInnovationGroupPatentBundle:
resource: "@MunichInnovationGroupPatentBundle/Controller/"
type:     annotation
prefix:   /
defaults:  { _controller: "MunichInnovationGroupPatentBundle:Default:index" }

MunichInnovationGroupBundle:
resource: "@MunichInnovationGroupBundle/Controller/"
type:     annotation
prefix:   /v1
defaults:  { _controller: "MunichInnovationGroupBundle:Patent:index" }

login_check:
pattern:   /login_check

logout:
pattern:   /logout

inside my controller i have

<?php
namespace MunichInnovationGroup\PatentBundle\Controller;

use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Request;
use JMS\SecurityExtraPatentBundle\Annotation\Secure;
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Symfony\Component\Security\Core\SecurityContext;

use MunichInnovationGroup\PatentBundle\Entity\Log;
use MunichInnovationGroup\PatentBundle\Entity\UserPatent;
use MunichInnovationGroup\PatentBundle\Entity\PmPortfolios;
use MunichInnovationGroup\PatentBundle\Entity\UmUsers;
use MunichInnovationGroup\PatentBundle\Entity\PmPatentgroups;
use MunichInnovationGroup\PatentBundle\Form\PortfolioType;
use MunichInnovationGroup\PatentBundle\Util\SecurityHelper;
use Exception;
/**
 * Portfolio controller.
 * @Route("/portfolio")
 */
class PortfolioController extends Controller {
/**
 * Index action.
 *
 * @Route("/", name="v2_pm_portfolio")
 * @Template("MunichInnovationGroupPatentBundle:Portfolio:index.html.twig")
 */
   public function indexAction(Request $request) {
    $portfolios = $this->getDoctrine()
    ->getRepository('MunichInnovationGroupPatentBundle:PmPortfolios')
    ->findBy(array('user' => '$user_id'));

           // rest of the method
  }

when i try to load localhost/web/app_dev.php/portfolio

It says

   Unknown Entity namespace alias 'MunichInnovationGroupPatentBundle'.

I am unable to figure out this error please help me if anyone has any idea I googled it a lot :(

Thanks in advance 500 Internal Server Error - ORMException

© Stack Overflow or respective owner

Related posts about orm

Related posts about symfony-2.0