/** * @see \Zend\ServiceManager\FactoryInterface::createService() * @param \Zend\ServiceManager\ServiceLocatorInterface $oServiceLocator * @return \Zend\Session\SessionManager */ public function createService(\Zend\ServiceManager\ServiceLocatorInterface $oServiceLocator) { $oSessionConfig = new \Zend\Session\Config\SessionConfig(); $aConfiguration = $oServiceLocator->get('config'); if (isset($aConfiguration['authentication']['remember_me_ttl'])) { $oSessionConfig->setRememberMeSeconds($aConfiguration['authentication']['remember_me_ttl']); } return new \Zend\Session\SessionManager($oSessionConfig); }
use Application\Service\SupplierService; use Application\Service\TemplateService; use Application\Service\WarehouseDocumentService; use Application\Service\WarehouseService; use Application\View\Helper\Messages; use DoctrineModule\Persistence\ObjectManagerAwareInterface; use Zend\Mvc\Controller\ControllerManager; use Zend\ServiceManager\ServiceManager; use Zend\Validator\Translator\TranslatorAwareInterface; return array('router' => array('routes' => array('home' => array('type' => 'Zend\\Mvc\\Router\\Http\\Literal', 'options' => array('route' => '/', 'defaults' => array('controller' => 'Application\\Controller\\Index', 'action' => 'index'))), 'language' => array('type' => 'Segment', 'options' => array('route' => '/language/:language', 'defaults' => array('__NAMESPACE__' => 'Application\\Controller', 'controller' => 'Index', 'action' => 'language'))), 'application' => array('type' => 'Segment', 'options' => array('route' => '/application[/:controller[/:action]]', 'constraints' => array('controller' => '[a-zA-Z][a-zA-Z0-9_-]*', 'action' => '[a-zA-Z][a-zA-Z0-9_-]*'), 'defaults' => array('__NAMESPACE__' => 'Application\\Controller', 'controller' => 'Index', 'action' => 'index')), 'may_terminate' => true, 'child_routes' => array('default' => array('type' => 'wildcard'))))), 'service_manager' => array('abstract_factories' => array('Zend\\Cache\\Service\\StorageCacheAbstractServiceFactory', 'Zend\\Log\\LoggerAbstractServiceFactory'), 'aliases' => array('translator' => 'MvcTranslator'), 'invokables' => array(), 'factories' => array('sessionManager' => function (ServiceManager $sm) { $sessionManager = new \Zend\Session\SessionManager(); $configuration = $sm->get('Config'); if (isset($configuration['sessionConfiguration'])) { $sessionConfig = new \Zend\Session\Config\SessionConfig(); if (isset($configuration['sessionConfiguration']['rememberMeSeconds'])) { $sessionConfig->setRememberMeSeconds($configuration['sessionConfiguration']['rememberMeSeconds']); } if (isset($configuration['sessionConfiguration']['savePath'])) { $target = $configuration['sessionConfiguration']['savePath']; if ($target === true) { $target = realpath(dirname($_SERVER['SCRIPT_FILENAME'])) . '/../data/session'; } if (!file_exists($target)) { mkdir($target); } $sessionConfig->setSavePath($target); } if (isset($configuration['sessionConfiguration']['options'])) { $sessionConfig->setOptions($configuration['sessionConfiguration']['options']); } $sessionManager->setConfig($sessionConfig);