Symfony3 相关问题

  1. 访问新Bundle报错

    1
    2
    3
    (1/1) ClassNotFoundException
    Attempted to load class "AppBundle" from namespace "Bundles\AppBundle".
    Did you forget a "use" statement for another namespace?

    打开 composer.json 文件,修改如下:

    1
    2
    3
    4
    5
    6
    "autoload": {
    "psr-4": {
    "": "src/"
    },
    "classmap": [ "app/AppKernel.php", "app/AppCache.php" ]
    }

    修改后运行 composer dump-autoload

  2. 生成实体类报错

    1
    2
    [RuntimeException]
    Namespace "Bundles\CommonBundle" does not contain any mapped entities.

    打开 config.yml, 配置 doctrine, 添加 mappings

    orm:    
     mappings:
         CommonBundle: ~
         #CommonBundle:
         #    type: yml
         #    dir: Resources/config/doctrine
    
0%