0

I have ha service with tag: event_subscribe (KernelEvents::REQUEST) with priority 30 and in the same module a service path_processor_inbound with priority 29

The problem is: in event_subscribe Service creo a Constant but the service path_processor_inbound is called before. I tried all the variants of priority, but it is not the problem.

  • in event_subscribe Service creo a Constant but the service path_processor_inbound is called before 29 comes before 30 so that's right isn't it? – Clive Feb 16 '17 at 16:53
  • No, i want call first event_subscribe – BOES Feb 16 '17 at 16:54
  • Please edit your question, it currently says the opposite – Clive Feb 16 '17 at 16:58
  • ! U undestand priority ? "The priority value is optional and defaults to 0. The higher the priority, the sooner it gets executed." – BOES Feb 16 '17 at 18:36
  • Oh I see, Symfony and Drupal have different definitions of "priority". In Drupal's API, a lower number means a higher priority; a numerical running order if you will. I'd post your code and describe the methods you're using to confirm the priority is being set properly etc – Clive Feb 16 '17 at 18:59
2

Both priorities are for different queues. If you set a priority for an event subscriber this is only for the specific event you subscribe to. In this example you subscribe to KernelEvents::REQUEST. Then you can only move up and down in the list of all other subscribers to this event.

You can find more information and a list of the D8 events here:

https://api.drupal.org/api/drupal/core!core.api.php/group/events/8.2.x

Path inbound/outbound processors are not even events. These are handled by the PathProcessor Manager and the priority set here is again only for the list of all other path processors.

  • ! can retrive a list with queque priority ? – BOES Feb 17 '17 at 8:29
  • I've checked, path processors are called dependent on the status of your cache and what module you've installed 5 or 10 times per request. So there is no single event you can target. But you can try to increase the priority for the KernelEvents:REQUEST subscriber until you have the result you want. – 4k4 Feb 17 '17 at 8:42
  • There is a great debugging tool from Symfony, Web Profiler. In Drupal this is included in the Devel module. – 4k4 Feb 17 '17 at 8:46
  • ! when path_processor don't have a queue specific ? – BOES Feb 17 '17 at 9:21
  • ! 30000000 priority, same problem. It's not a prority problem – BOES Feb 17 '17 at 9:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.