So I have a Symfony 6.2 API, PHP 8.2 codebase.
While trying to run composer install/update the following error is displaying and I'm wondering how to clear it:
In CheckExceptionOnInvalidReferenceBehaviorPass.php line 83:
The service "doctrine.orm.default_annotation_metadata_driver" has a dependency
on a non-existent service "doctrine.orm.metadata.annotation_reader".
If I comment out the mappings section in doctrine.yaml file (below) composer runs successfully, however all POST requests to the api will then result in the following error:
Could not find the entity manager for class App\Entity\Token.
Check your Doctrine configuration to make sure it is configured
to load this entity’s metadata. (500 Internal Server Error)
Scratching my head here to understand how to resolve it. I've a feeling it may be doctrine.yaml related but I could be miles off the mark.
composer.json:
"require": {
"php": ">=8.2",
...
"doctrine/doctrine-bundle": "^2.8",
"doctrine/doctrine-migrations-bundle": "^3.2",
"doctrine/orm": "^2.14",
...
},
doctrine.yaml:
doctrine:
dbal:
url: '%env(resolve:DATABASE_URL)%'
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'
CodePudding user response:
Try to add in your composer.json file:
doctrine/annotations
CodePudding user response:
It will not be the exact answer to your question, but my advise is to move PHP 8.1 attubutes instead of doctrine annotations.
Set your mapping type to
type: attribute
More info about the attribute settings can be found here:
https://www.doctrine-project.org/projects/doctrine-orm/en/2.14/reference/attributes-reference.html