Today i tried to copy/past an entity from a project to an other. First i tried to create the entity with
php bin/console make:entity
And to copy/past the entity class into the file just created. Didn't work and got this error message i can't figure out.
My configuration is a new symfony 5.4 project. And symfony 5.4 for the other project.
The only things that change is that in the first projet i used annotation system (@ORM\Table...) and the new one is attributes by default (#[ORM\...
). But i used to use both on other projects and worked well.
I tried to change annotation to attribute and it works. But i would like to know how can i use both annotations and attributes on the project, it used to be the default value ?
My 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: '14'
orm:
auto_generate_proxy_classes: true
naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
auto_mapping: true
mappings:
App:
is_bundle: false
dir: '%kernel.project_dir%/src/Entity'
prefix: 'App\Entity'
alias: App
What i tried :
- cache clear
- remove/create entity
- check on internet for some solutions
- check if
use Doctrine\ORM\Mapping as ORM;
was in my file
What i tried :
- cache clear
- remove/create entity
- check on internet for some solutions
- check if
use Doctrine\ORM\Mapping as ORM;
was in my file
CodePudding user response:
Symfony does not support both, you have to choose between of 2, so if you don't have any php version problem, both should fit