Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate ORM proxy commands #1524

Closed
dmaicher opened this issue May 9, 2022 · 4 comments
Closed

Deprecate ORM proxy commands #1524

dmaicher opened this issue May 9, 2022 · 4 comments

Comments

@dmaicher
Copy link
Contributor

dmaicher commented May 9, 2022

As mentioned in #1513 (comment) 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.

@stof
Copy link
Member

stof commented May 10, 2022

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.

@ostrolucky
Copy link
Member

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

<tag name="console.command" command="dbal:run-sql" />
Why wouldn't this work for ORM?

@dmaicher
Copy link
Contributor Author

dmaicher commented Jun 20, 2022

@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.

@stof
Copy link
Member

stof commented Jul 22, 2022

In case the description in the proxy command is better than the one in the ORM command, we should update the description upstream.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants