Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

accommodate ServiceLocatorAwareInterface #159

Merged
merged 4 commits into from

8 participants

Bas Kamer Gourdeau Nicolas Jérémy Huet Alex Frenkel DaveTheAve ilkayorhanlar Zacharias Luiten Rob Allen
Bas Kamer

see #156

Gourdeau Nicolas

Hi

I did almost the same ZF-Commons/ZfcUser#179, did not see your request...

Bas Kamer

this has been up for a while... could someone look at it as it blocks using it on with zf2 develop branch

thanks

Jérémy Huet

+1 thanks !

Alex Frenkel

When will this be merged?

DaveTheAve

This has made it possible for me to use ZfcUser as-well. Thank you contributors!

ilkayorhanlar

Thank you

Zacharias Luiten

Can this be merged please?

Rob Allen akrabat merged commit ee18443 into from
Rob Allen
Owner

Thanks.

Zacharias Luiten

Thanks @akrabat !!

Bas Kamer

hurray! thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
17 Module.php
View
@@ -31,6 +31,23 @@ public function getConfig($env = null)
return include __DIR__ . '/config/module.config.php';
}
+ public function getControllerPluginConfig()
+ {
+ return array(
+ 'factories' => array(
+ 'zfcUserAuthentication' => function ($sm) {
+ $serviceLocator = $sm->getServiceLocator();
+ $authService = $serviceLocator->get('zfcuser_auth_service');
+ $authAdapter = $serviceLocator->get('ZfcUser\Authentication\Adapter\AdapterChain');
+ $controllerPlugin = new Controller\Plugin\ZfcUserAuthentication;
+ $controllerPlugin->setAuthService($authService);
+ $controllerPlugin->setAuthAdapter($authAdapter);
+ return $controllerPlugin;
+ },
+ ),
+ );
+ }
+
public function getViewHelperConfig()
{
return array(
5 config/module.config.php
View
@@ -10,11 +10,6 @@
'zfcuser' => 'ZfcUser\Controller\UserController',
),
),
- 'controller_plugins' => array(
- 'invokables' => array(
- 'zfcuserauthentication' => 'ZfcUser\Controller\Plugin\ZfcUserAuthentication',
- ),
- ),
'service_manager' => array(
'aliases' => array(
'zfcuser_zend_db_adapter' => 'Zend\Db\Adapter\Adapter',
37 src/ZfcUser/Controller/Plugin/ZfcUserAuthentication.php
View
@@ -4,11 +4,10 @@
use Zend\Mvc\Controller\Plugin\AbstractPlugin;
use Zend\Authentication\AuthenticationService;
-use Zend\ServiceManager\ServiceManagerAwareInterface;
-use Zend\ServiceManager\ServiceManager;
+use Zend\ServiceManager\ServiceLocatorInterface;
use ZfcUser\Authentication\Adapter\AdapterChain as AuthAdapter;
-class ZfcUserAuthentication extends AbstractPlugin implements ServiceManagerAwareInterface
+class ZfcUserAuthentication extends AbstractPlugin
{
/**
* @var AuthAdapter
@@ -21,10 +20,10 @@ class ZfcUserAuthentication extends AbstractPlugin implements ServiceManagerAwar
protected $authService;
/**
- * @var ServiceManager
+ * @var ServiceLocatorInterface
*/
- protected $serviceManager;
-
+ protected $serviceLocator;
+
/**
* Proxy convenience method
*
@@ -52,9 +51,6 @@ public function getIdentity()
*/
public function getAuthAdapter()
{
- if (null === $this->authAdapter) {
- $this->authAdapter = $this->getServiceManager()->get('ZfcUser\Authentication\Adapter\AdapterChain');
- }
return $this->authAdapter;
}
@@ -76,9 +72,6 @@ public function setAuthAdapter(AuthAdapter $authAdapter)
*/
public function getAuthService()
{
- if (null === $this->authService) {
- $this->authService = $this->getServiceManager()->get('zfcuser_auth_service');
- }
return $this->authService;
}
@@ -93,24 +86,4 @@ public function setAuthService(AuthenticationService $authService)
return $this;
}
- /**
- * Retrieve service manager instance
- *
- * @return ServiceManager
- */
- public function getServiceManager()
- {
- return $this->serviceManager->getServiceLocator();
- }
-
- /**
- * Set service manager instance
- *
- * @param ServiceManager $locator
- * @return void
- */
- public function setServiceManager(ServiceManager $serviceManager)
- {
- $this->serviceManager = $serviceManager;
- }
}
Something went wrong with that request. Please try again.