这里是Symfony的新手
我正在关注有关将db表映射到实体的this教程。我在db中创建了.active
和blog_post
表。
我尝试运行此blog_comment
,这会吐出以下错误。
php bin/console doctrine:mapping:import --force AppBundle xml
我的Bundle "AppBundle" does not exist or it is not enabled. Maybe you forgot to
add it in the registerBundles() method of your App\Kernel.php file?
非常开箱即用。
Doctrine.yaml
doctrine.yaml
我在doctrine:
dbal:
# configure these for your database server
driver: 'pdo_mysql'
server_version: '5.7'
charset: utf8mb4
# With Symfony 3.3, remove the `resolve:` prefix
url: '%env(resolve:DATABASE_URL)%'
orm:
auto_generate_proxy_classes: '%kernel.debug%'
naming_strategy: doctrine.orm.naming_strategy.underscore
auto_mapping: true
mappings:
App:
is_bundle: true
type: annotation
dir: '%kernel.project_dir%/src/Entity'
prefix: 'App\Entity'
alias: App
下创建了App.php类,并在src/Entity/
下添加了一行,但仍然出错。我在bundles.php上添加的行是
bundles.php
因为那是我App.php类的已定义的命名空间。
我得到的另一个错误是
App\Entity\App::class=>['all' => true],
答案 0 :(得分:1)
在here中也发现了类似的情况。
因为Symfony 4使用App而不是Appbundle
答案 1 :(得分:1)
你必须在Symfony 4上使用App而不是AppBundle