-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Method for adding extra identifiers to Abstract Controller Event Manager #6553
Conversation
I'd actually prefer that we use the existing
If you make that change, I'll merge. |
@@ -159,13 +165,19 @@ public function getResponse() | |||
*/ | |||
public function setEventManager(EventManagerInterface $events) | |||
{ | |||
$events->setIdentifiers(array( | |||
$eventManagerIdentifiers = array( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indented with 4+5 spaces instead of 4+4.
…ger - Last Changes
Hope its OK now |
get_class($this), | ||
$this->eventIdentifier, | ||
substr(get_class($this), 0, strpos(get_class($this), '\\')) | ||
)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep the above, but remove the $this->eventIdentifier
entry.
…ger - FINAL -space to method getResponse() removed
I did changes there. Thank you very much for the guideness. Just a question: why not simply casting (array cast) rather than checking if $this->eventIdentifier is array? Is there a performance matter? Thanks in advance. |
More of a "it doesn't always work the way you expect" situation, particularly with empty values. |
Thanks for the reply |
…uced by allowing array string identifiers
…ler' into develop Close #6553
@ibekiaris I added tests and manually merged into |
I extended the functionallity of Zend\Mvc\Controller\AbstractController because i face the following problem:
There was a need of a Zf2 module with the following structure:
Module Name: Modules
Modules
-- FolderA
-- FolderB
-- foldera
-- folderb
I wanted to disable the layout only for that module. So i need an identifier for that module only.
However namespace configuration was the following
Tha means that identifiers in AbstractController event manager are:
'Zend\Stdlib\DispatchableInterface'
'Zend\Mvc\Controller\AbstractController'
'FolderA\Controller\IndexController'
'AbstractModulesController'
'FolderA' (or FolderB)
So i ve added some lines of code in case someone need to extend AstractActionController and implement his own
"AbstractActionController" class setting also his own identifiers to the event manager.