Doctrine cannot map entity/repository namespace in chain

后端 未结 4 1806
暗喜
暗喜 2021-01-24 17:44

I\'m trying to setup symfony with doctrine, configuring doctrine is new for me.

I try to retrieve a entity from the database by using the following code in my controller

4条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-24 18:28

    Your bundle isn't declare in the AppKernel file or your doctrine mapping isn't reconized.

    You should have in your AppKernel :

    public function registerBundles()
    {
        $bundles = array(
            ...
            new AppBundle\AppBundle(),
        );
    
        ....
    
        return $bundles;
    }
    

    And by default in your config.yml :

    orm:
        auto_generate_proxy_classes: %kernel.debug%
        auto_mapping: true
    

提交回复
热议问题