phoenix
phoenix copied to clipboard
Deprecate ORM proxy commands
As mentioned in https://github.com/doctrine/DoctrineBundle/pull/1513#discussion_r859096142 the proxy commands would just change the command name and description once we remove the deprecated helper approach of providing the entity manager in 3.0.
So we should deprecate them and prepare a path of removing them.
As suggested in the linked discussion we could make the name and description configurable on the ORM commands or change them there directly.
The need for the ORM is actually to keep the command name configurable (the base Command constructor accepts a name).
Then, the bundle could add the name in the tag (for lazyness) and in the constructor (so that the command has the right name).
but the current code setting the name in configure
in the ORM means that it overrides any name set in the constructor
For the description, I don't think we need to override it in the bundle.
As far as I can see, DBAL also defines name in configure
and we don't care about it, we just specify name in tag. Like here https://github.com/doctrine/DoctrineBundle/blob/b7002752b555cb61cc9ca8d4c89a5b6e8200f765/Resources/config/dbal.xml#L104-L104 Why wouldn't this work for ORM?
@ostrolucky indeed I think this works. I just tried this diff on one of my apps:
- <service id="doctrine.cache_clear_query_cache_command" class="Doctrine\Bundle\DoctrineBundle\Command\Proxy\ClearQueryCacheDoctrineCommand">
+ <service id="doctrine.cache_clear_query_cache_command" class="Doctrine\ORM\Tools\Console\Command\ClearCache\QueryCommand">
<argument type="service" id="doctrine.orm.command.entity_manager_provider" />
<tag name="console.command" command="doctrine:cache:clear-query" />
</service>
and the configured name from the tag works:
$ bin/console doctrine:cache:clear-query --help
Description:
Clear all query cache of the various cache drivers
Usage:
doctrine:cache:clear-query [options]
Just the description is now of course the default one provided by the ORM command.
In case the description in the proxy command is better than the one in the ORM command, we should update the description upstream.