我使用 yaml 映射
当我尝试时php bin/console doctrine:generate:entities App --no-backup
,我得到了错误
找不到“App\Entity\User”的基本路径
教义.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: false
type: 'yml'
dir: '%kernel.project_dir%/config/doctrine'
prefix: 'App\Entity'
alias: 'App'
示例 User.orm.yml:
App\Entity\User:
type: entity
table: tbl_user
repositoryClass: App\Entity\UserRepository
fields:
username:
type: string
length: 40
nullable: true
password:
type: string
length: 40
nullable: true