-
-
Notifications
You must be signed in to change notification settings - Fork 45
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
Bug: Navigation Helper - isAllowed function - ACLlistener is Attached Several Times #12
Comments
Here is my workaround that I absolutely hate In one of my module I am adding a delegator at the "navigation" view helper level
Here is the delegator:
Because it is a delegator this code is executed before any initializers. Get the navigation helper and tell him to reuse Acl - so that the event is actually triggered in the "accept" function Now the ugly part is I add another delegator on all the Navigation Plugin Manager level for each Navigation Helpers
This delegator does the same thing than above It has to be delegators and cannot be initializers because the issue comes from the Initializer added by the Navigation View Helper Plugin Manager (in the __construct function) So I hate this workaround - but I don't think we can do it another way. Originally posted by @cgaube at zendframework/zend-view#129 (comment) |
Also it would be nice if the the isAllowed function had some kind of caching mechanism at the navigation container level - so it does not have to trigger events over and over if a page has already been accepted before By the way - I would be more than happy to do the work if needed - Originally posted by @cgaube at zendframework/zend-view#129 (comment) |
Another improvement: Zend\View\Helper\Navigation\AbstractHelper
Originally posted by @cgaube at zendframework/zend-view#129 (comment) |
@aft-christophe
This will be addressed for version 3 of
Why does Originally posted by @froschdesign at zendframework/zend-view#129 (comment) |
Thank you
That s great.
Ok so because it is related to navigation you want that in the navigation repo - that s fine by me. We could ask the question the other way around though - why would zend-navigation need to Thanks Originally posted by @cgaube at zendframework/zend-view#129 (comment) |
@aft-christophe
I never said that! 😃 Btw. I think, before version 3 we can add some small improvements like stopping the propagation. Originally posted by @froschdesign at zendframework/zend-view#129 (comment) |
Here is a fun bug for you all.
Everytime you instantiate a new Navigation Helper the the same Listener is attached to the shared Manager once again.
file: https://github.com/zendframework/zend-view/blob/master/src/Helper/Navigation/AbstractHelper.php
so if you do
Then the same AclListener function will be attached 3 times
It means that everytime the "isAllowed" function is called (it is called a LOT) then the AclListener function is called X times (3 times in my example).........
To fix this issue I believe that Zend View should not be in charge of registering any event
So my fix would be to get rid of this function altogether.
The Acl Listener should be moved the the zend-acl repository
And it should be the user responsibility to register any event on the isAllowed function.
Originally posted by @cgaube at zendframework/zend-view#129
The text was updated successfully, but these errors were encountered: