gpt4 book ai didi

php - 制作 :entity command: [ERROR] Only annotation mapping is supported by make:entity

转载 作者:行者123 更新时间:2023-12-03 23:39:25 25 4
gpt4 key购买 nike

当我尝试在 Symfony 5.2 (maker-bundle v1.30.0) 中创建一个新的 Doctrine 实体时,我得到:

$ php bin/console make:entity

Class name of the entity to create or update (e.g. GrumpyChef):
> test

created: src/Entity/Test.php
created: src/Repository/TestRepository.php


[ERROR] Only annotation mapping is supported by make:entity, but the
<info>App\Entity\Test</info> class uses a different format. If you
would like this command to generate the properties & getter/setter
methods, add your mapping configuration, and then re-run this command
with the <info>--regenerate</info> flag.
文件已生成,对我来说它们看起来不错。除了“创建”行之外,我对现有实体也得到相同的结果。几年前我已经读过类似的问题,但它们与不同的命名空间有关,这里不是这种情况,我使用的是默认命名空间。
我相信这个问题与更新有关,因为它以前(不确定它是 5.0 还是 5.1)当然有效。
有什么方法可以调试 MakerBundle 或知道如何解决这个问题吗?
谢谢。
../config/packages/doctrine.yaml(我想我从未接触过这个):
doctrine:
dbal:
url: '%env(resolve:DATABASE_URL)%'

# IMPORTANT: You MUST configure your server version,
# either here or in the DATABASE_URL env var (see .env file)
#server_version: '5.7'
orm:
auto_generate_proxy_classes: true
naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
auto_mapping: true
mappings:
App:
is_bundle: false
type: annotation
dir: '%kernel.project_dir%/src/Entity'
prefix: 'App\Entity'
alias: App
$ php bin/console debug:config doctrine

Current configuration for extension with alias "doctrine"
=========================================================

doctrine:
dbal:
default_connection: default
connections:
default:
url: '%env(resolve:DATABASE_URL)%'
override_url: false
driver: pdo_mysql
logging: true
profiling: true
profiling_collect_backtrace: false
profiling_collect_schema_errors: true
options: { }
mapping_types: { }
default_table_options: { }
slaves: { }
replicas: { }
shards: { }
types: { }
orm:
auto_generate_proxy_classes: true
default_entity_manager: default
entity_managers:
default:
naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
auto_mapping: true
mappings:
App:
is_bundle: false
type: annotation
dir: <<root_path>>/src/Entity
prefix: App\Entity
alias: App
mapping: true
query_cache_driver:
type: null
metadata_cache_driver:
type: null
result_cache_driver:
type: null
class_metadata_factory_name: Doctrine\ORM\Mapping\ClassMetadataFactory
default_repository_class: Doctrine\ORM\EntityRepository
quote_strategy: doctrine.orm.quote_strategy.default
entity_listener_resolver: null
repository_factory: doctrine.orm.container_repository_factory
hydrators: { }
filters: { }
proxy_dir: '%kernel.cache_dir%/doctrine/orm/Proxies'
proxy_namespace: Proxies
resolve_target_entities: { }

最佳答案

https://github.com/symfony/maker-bundle/issues/841
symfony/maker-bundle v1.30.1 修复了它。

关于php - 制作 :entity command: [ERROR] Only annotation mapping is supported by make:entity,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66741930/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com