/** * Create service * * @param ServiceLocatorInterface $serviceManager * @return mixed */ public function createService(ServiceLocatorInterface $serviceManager) { $locator = $serviceManager->getServiceLocator(); $viewHelper = new View\Helper\ZfcUserIdentity(); $viewHelper->setAuthService($locator->get('zfcuser_auth_service')); return $viewHelper; }
/** * @param string $setting * @param UserInterface $user * @return */ public function getSetting($setting, UserInterface $user = null) { if (!$user) { $user = $this->zfcUserIdentity->__invoke(); } return $this->userSettingsService->getvalue($setting, $user); }
protected function _before() { $helper = new ZfcUserIdentity(); $this->helper = $helper; $authService = $this->getMock('Zend\\Authentication\\AuthenticationService'); $this->authService = $authService; $helper->setAuthService($authService); }
public function setUp() { $helper = new ViewHelper(); $this->helper = $helper; $authService = $this->getMock('Zend\\Authentication\\AuthenticationService'); $this->authService = $authService; $helper->setAuthService($authService); }
/** * {@inheritDoc} */ public function createService(ServiceLocatorInterface $pluginManager) { /* @var $pluginManager HelperPluginManager */ $serviceManager = $pluginManager->getServiceLocator(); /* @var $authService AuthenticationService */ $authService = $serviceManager->get('zfcuser_auth_service'); $viewHelper = new ZfcUserIdentity(); $viewHelper->setAuthService($authService); return $viewHelper; }
public function getViewHelperConfig() { return array('factories' => array('zfcUserDisplayName' => function ($sm) { $locator = $sm->getServiceLocator(); $viewHelper = new View\Helper\ZfcUserDisplayName(); $viewHelper->setAuthService($locator->get('zfcuser_auth_service')); return $viewHelper; }, 'zfcUserIdentity' => function ($sm) { $locator = $sm->getServiceLocator(); $viewHelper = new View\Helper\ZfcUserIdentity(); $viewHelper->setAuthService($locator->get('zfcuser_auth_service')); return $viewHelper; }, 'zfcUserLoginWidget' => function ($sm) { $locator = $sm->getServiceLocator(); $viewHelper = new View\Helper\ZfcUserLoginWidget(); $viewHelper->setLoginForm($locator->get('zfcuser_login_form')); return $viewHelper; })); }