Skip to content

Instantly share code, notes, and snippets.

@zluiten
Created June 14, 2013 07:38
Show Gist options
  • Save zluiten/5780135 to your computer and use it in GitHub Desktop.
Save zluiten/5780135 to your computer and use it in GitHub Desktop.
<?php
class SomeController extends AbstractController
{
protected $someService;
public function indexAction()
{
$service = $this->getSomeService();
}
public function getSomeService()
{
if (!$this->someService) {
$this->someService = $this->getServiceLocator()->get('Get\Your\Service');
}
return $this->someService;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment