Skip to content

Instantly share code, notes, and snippets.

@eminetto
Created November 4, 2012 14:08
Show Gist options
  • Save eminetto/4012071 to your computer and use it in GitHub Desktop.
Save eminetto/4012071 to your computer and use it in GitHub Desktop.
<?php
namespace Core\View\Helper;
use Zend\View\Helper\AbstractHelper;
use Zend\ServiceManager\ServiceLocatorAwareInterface;
use Zend\ServiceManager\ServiceLocatorInterface;
/**
* Helper que inclui a sessão nas views
*
* @category Application
* @package View\Helper
* @author Elton Minetto <[email protected]>
*/
class Session extends AbstractHelper implements ServiceLocatorAwareInterface
{
/**
* Set the service locator.
*
* @param ServiceLocatorInterface $serviceLocator
* @return CustomHelper
*/
public function setServiceLocator(ServiceLocatorInterface $serviceLocator)
{
$this->serviceLocator = $serviceLocator;
return $this;
}
/**
* Get the service locator.
*
* @return \Zend\ServiceManager\ServiceLocatorInterface
*/
public function getServiceLocator()
{
return $this->serviceLocator;
}
public function __invoke()
{
$helperPluginManager = $this->getServiceLocator();
$serviceManager = $helperPluginManager->getServiceLocator();
return $serviceManager->get('Session');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment