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

compiler pass for route filters #71

Open
dbu opened this issue Jul 15, 2013 · 4 comments
Open

compiler pass for route filters #71

dbu opened this issue Jul 15, 2013 · 4 comments

Comments

@dbu
Copy link
Member

dbu commented Jul 15, 2013

Port the route filters pass from drupal into the component. Left over from #70

see http://drupalcode.org/project/drupal.git/blob/refs/heads/8.x:/core/lib/Drupal/Core/DependencyInjection/Compiler/RegisterRouteFiltersPass.php
btw, why is there no priorities on the filters pass? the enhancer and router passes do have priorities. for performance reasons, priorities could also be important here.

when we do that, don't forget to enable the pass in the CmfRoutingBundle

/cc @Crell

@dbu
Copy link
Member Author

dbu commented Mar 24, 2014

@dawehner if you have too much time left after #97 this could be another cleanup. though much less important.

@dawehner
Copy link
Contributor

In the meantime we abstracted that into http://cgit.drupalcode.org/drupal/tree/core/lib/Drupal/Core/DependencyInjection/Compiler/TaggedHandlersPass.php?id=refs/heads;id2=8.0.x

which allows you to specify a service to collect other services.
This would be the "collector" service:

  breadcrumb:
    class: Drupal\Core\Breadcrumb\BreadcrumbManager
    arguments: ['@module_handler']
    tags:
      - { name: service_collector, tag: breadcrumb_builder, call: addBuilder }

and then you do something like that in the client service:

  forum.breadcrumb.listing:
    class: Drupal\forum\Breadcrumb\ForumListingBreadcrumbBuilder
    arguments: ['@entity.manager', '@config.factory', '@forum_manager']
    tags:
      - { name: breadcrumb_builder, priority: 314 }

Do you think that this is something we could even push into symfony itself?

@dbu
Copy link
Member Author

dbu commented Nov 14, 2014

@dawehner sorry for the late reply. are you proposing a generic way of doing compiler passes for tags? compiler passes can do all kind of things, but for the standard case of late-and-implicit hooking up services together, this seems a good idea to me. i would propose that to symfony and see if they like the idea. it seems a DX improvement to me. a variant of your proposal would be a generic compiler pass that the bundle can instantiate with the options about the receiving service and its add-method and the tag name - might be a tad more straightforward. (what would happen if we define several service collectors for the same tag?)

@dbu
Copy link
Member Author

dbu commented Nov 14, 2014

feel free to ping me in the symfony/symfony issue to help with the discussion, btw.

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

2 participants