-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Retrieve the InjectTemplateListener from the service manager. #7046
Retrieve the InjectTemplateListener from the service manager. #7046
Conversation
As usual, I have to bother about tests :-) |
The factory name is the fully qualified name to minimise chance of a name clash.
@Ocramius Tests written now! |
*/ | ||
public function createService(ServiceLocatorInterface $serviceLocator) | ||
{ | ||
$config = $serviceLocator->get('Config'); |
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.
Should have a different name (from the resulting config) to avoid confusion
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.
What about directly checking for controller_map
here instead of having an additional isset()
later on?
Also, ensure that controller_map is an array as the parameter to setControllerMap() is type hinted.
…implements ArrayAccess.
Updated as per comments. |
|
||
$config = $serviceLocator->get('Config'); | ||
if (isset($config['view_manager']) | ||
&& (is_array($config['view_manager']) || $config['view_manager'] instanceof ArrayAccess) |
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.
You can actually avoid checking isset($config['view_manager'])
, as a single isset()
check is enough and won't cause notices. See http://3v4l.org/KPKN9
Updated. |
Looking good: adding to my next merge spree. |
…anager' into develop Close #7046
This makes it possible to use your own InjectTemplateListener.