-
Notifications
You must be signed in to change notification settings - Fork 203
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
EZP-30689: Registered Query Types for automatic configuration #2834
EZP-30689: Registered Query Types for automatic configuration #2834
Conversation
Provided automatic configuration for every service which implements `eZ\Publish\Core\QueryType\QueryType` by auto-tagging it with the "ezpublish.query_type" service tag.
2eec022
to
3a15bcb
Compare
Use Symfony service automatic configuration (`autoconfigure: true`) instead.
3a15bcb
to
1d86261
Compare
As long as the developer experience is the same in the end, I'm fine with the change. |
For e.g. Demo no change is required, which proves my point :) |
There is one thing that breaks: if you define query types in bundles other than |
Properly written bundle should register those as services anyway, but...
We could add that, reported it already as a bug (EZP-31064) because this PR is going to be merged in a moment to unblock QA on #2651. |
QA will be done on #2651. |
|
Yes, therefore added EZP-31064. |
master (8.0@dev)
for eZ Platform v3.0This PR both provides an improvement and fixes broken behat test for Query Types by providing automatic configuration for them (
autoconfigure: true
causing auto-tagging of the services which implement\eZ\Publish\Core\QueryType\QueryType
withezpublish.query_type
).The reason for doing it now is unblocking Travis for #2651 to proceed with QA.
Breaking changes
Traversing through bundles to automatically register Query Types by the naming convention
<Bundle>\QueryType\*QueryType
has been dropped.This convention imposed on a Developer specific directory structure, which is Symfony 2 mindset. Instead we provided automatic configuration for all services which implement
QueryType
interface.It might seem like an additional setup step, but in fact, when we look at the
services.yaml
shipped with Symfony 4, we can see that the entiresrc
directory has been mapped toApp\*
services with auto-configuration. It means that just placing that class in developer-chosen "autoconfigured" namespace is enough. It yields the same DX as it used to, without 50 lines of our code.Doc
If the changes are accepted, the section "By convention" needs to be dropped or rephrased. The replacement convention now is auto-configuring service. The following section "Using a service tag" needs to be adjusted.
DIC config examples:
Recommended:
By Service Tag:
By explicit alias instead of name (might be required in the future, if your QueryType needs to be
lazy
):TODO:
\eZ\Publish\Core\QueryType\QueryType
for auto-configuration.ezpublish.query_type
" to a constant.$ composer fix-cs
).