Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Retrieve the InjectTemplateListener from the service manager. #7046

Closed

Conversation

akrabat
Copy link
Contributor

@akrabat akrabat commented Dec 16, 2014

This makes it possible to use your own InjectTemplateListener.

akrabat added a commit to akrabat/zf2-action-skeleton that referenced this pull request Dec 16, 2014
@Ocramius
Copy link
Member

As usual, I have to bother about tests :-)

@akrabat
Copy link
Contributor Author

akrabat commented Dec 16, 2014

@Ocramius Tests written now!

*/
public function createService(ServiceLocatorInterface $serviceLocator)
{
$config = $serviceLocator->get('Config');
Copy link
Member

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

Copy link
Member

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?

@akrabat
Copy link
Contributor Author

akrabat commented Dec 19, 2014

Updated as per comments.


$config = $serviceLocator->get('Config');
if (isset($config['view_manager'])
&& (is_array($config['view_manager']) || $config['view_manager'] instanceof ArrayAccess)
Copy link
Member

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

@akrabat
Copy link
Contributor Author

akrabat commented Dec 19, 2014

Updated.

@Ocramius
Copy link
Member

Looking good: adding to my next merge spree.

Ocramius added a commit that referenced this pull request Jan 1, 2015
Ocramius added a commit that referenced this pull request Jan 1, 2015
Ocramius added a commit that referenced this pull request Jan 1, 2015
Ocramius added a commit that referenced this pull request Jan 1, 2015
Ocramius added a commit that referenced this pull request Jan 1, 2015
Ocramius added a commit that referenced this pull request Jan 1, 2015
Ocramius added a commit that referenced this pull request Jan 1, 2015
Ocramius added a commit that referenced this pull request Jan 1, 2015
Ocramius added a commit that referenced this pull request Jan 1, 2015
Ocramius added a commit that referenced this pull request Jan 1, 2015
Ocramius added a commit that referenced this pull request Jan 1, 2015
Ocramius added a commit that referenced this pull request Jan 1, 2015
@Ocramius
Copy link
Member

Ocramius commented Jan 1, 2015

@akrabat merged into develop at d98b642, thanks!

@Ocramius Ocramius closed this Jan 1, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants