[doctrine-bundle] Minimum doctrine/orm version too low
fwolfsjaeger opened this issue · 10 comments
I've just upgraded the recipe doctrine/doctrine-bundle to version 2.10.0, which adds 2 config options to doctrine.yaml:
- report_fields_where_declared: true
- validate_xml_mapping: true
Both of those variables are unknown to doctrine/orm version 2.15.2, which is the current stable version. Please update the minimum version requirement of the bundle accordingly.
validate_xml_mapping
refers to a feature added in 2.14.
report_fields_where_declared: true
will indeed be a no-op in ORM 2.15. But it does not break things.
Interesting, I got an error stating that those 2 are unknown when running composer update
on 2.15.2. So, composer was actually broken for me until I've commented those 2 out.
I'll try it again just in case.
which error did you get exactly ?
I just activated those 2 options in doctrine.yaml on doctrine/orm v2.15.2 and got the following error message when running e. g. bin/console cache:clear
:
Unrecognized options "report_fields_where_declared, validate_xml_mapping" under
"doctrine.orm". Available options are "auto_generate_proxy_classes",
"controller_resolver", "default_entity_manager", "enable_lazy_ghost_objects",
"entity_managers", "proxy_dir", "proxy_namespace", "resolve_target_entities".
For me the solution is simple, just remove those 2 lines and everything works. I just wanted to prevent others from having issues with it.
This error tells me that you are not using DoctrineBundle 2.10. You get the error from DoctrineBundle, not from a doctrine/orm class.
those options have been added only in the 2.10 version of the DoctrineBundle recipe.
$ composer show doctrine/doctrine-bundle
name : doctrine/doctrine-bundle
descrip. : Symfony DoctrineBundle
keywords : database, dbal, orm, persistence
versions : * 2.10.0
$ composer show doctrine/orm
name : doctrine/orm
descrip. : Object-Relational-Mapper for PHP
keywords : database, orm
versions : * 2.15.2
I am aware that those options have been added with DoctrineBundle 2.10. What I'm saying is that they are not available in doctrine/orm 2.15.2 yet. Which is why I was suggesting to increase the required doctrine/orm version to 2.16.
The comment in https://www.doctrine-project.org/projects/doctrine-bundle/en/latest/configuration.html also states that it requires 2.16:
# Opt-in to new mapping driver mode as of Doctrine ORM 2.16, https://github.com/doctrine/orm/pull/10455
Unfortunately, I could not find any information about validate_xml_mapping
.
Please share you full DoctrineBundle config. My guess is that the error is caused by a mix between the single-entity-manager and multi-entity-manager modes of the configuration (you cannot add it directly under doctrine.orm
if your configuration is not in single-entity-manager mode).
The error you get is not coming from doctrine/orm at all. It is an error that happens during the validation of the DoctrineBundle configuration (before we even do anything with that config to apply it in the bundle). And we don't have checks on the installed ORM version to conditionally declare those options as known.
You are right, when moved into the entity_managers configuration it doesn't cause any issues anymore. Thanks a lot and sorry for wasting your time.