From 65a57a4f0b32f91841f4b77aa9d246fe9246ce5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Str=C3=B8m?= Date: Sat, 7 May 2016 13:11:26 +0200 Subject: [PATCH 1/3] Remove old "use" statements for ServiceManagerAwareInterface --- src/ZfcUser/Authentication/Adapter/Db.php | 2 -- src/ZfcUser/Authentication/Storage/Db.php | 1 - src/ZfcUser/Factory/Service/UserFactory.php | 24 +++++++++++++++++++++ 3 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 src/ZfcUser/Factory/Service/UserFactory.php diff --git a/src/ZfcUser/Authentication/Adapter/Db.php b/src/ZfcUser/Authentication/Adapter/Db.php index a4f0db06..b07744ca 100644 --- a/src/ZfcUser/Authentication/Adapter/Db.php +++ b/src/ZfcUser/Authentication/Adapter/Db.php @@ -2,9 +2,7 @@ namespace ZfcUser\Authentication\Adapter; -use DateTime; use Zend\Authentication\Result as AuthenticationResult; -use Zend\ServiceManager\ServiceManagerAwareInterface; use Zend\ServiceManager\ServiceManager; use Zend\Crypt\Password\Bcrypt; use Zend\Session\Container as SessionContainer; diff --git a/src/ZfcUser/Authentication/Storage/Db.php b/src/ZfcUser/Authentication/Storage/Db.php index f396630e..62bdef8f 100644 --- a/src/ZfcUser/Authentication/Storage/Db.php +++ b/src/ZfcUser/Authentication/Storage/Db.php @@ -4,7 +4,6 @@ use Zend\Authentication\Storage; use Zend\Authentication\Storage\StorageInterface; -use Zend\ServiceManager\ServiceManagerAwareInterface; use Zend\ServiceManager\ServiceManager; use ZfcUser\Mapper\UserInterface as UserMapper; diff --git a/src/ZfcUser/Factory/Service/UserFactory.php b/src/ZfcUser/Factory/Service/UserFactory.php new file mode 100644 index 00000000..1c22ee0e --- /dev/null +++ b/src/ZfcUser/Factory/Service/UserFactory.php @@ -0,0 +1,24 @@ +setServiceManager($serviceLocator); + return $service; + } +} From d26883598743e17914b713a536d0c61cb545f1fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Str=C3=B8m?= Date: Sat, 7 May 2016 13:11:43 +0200 Subject: [PATCH 2/3] Remove ServiceManagerAwareInterface from User service --- Module.php | 3 ++- src/ZfcUser/Service/User.php | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Module.php b/Module.php index 0e0cfa4f..e1ac80d6 100644 --- a/Module.php +++ b/Module.php @@ -67,7 +67,6 @@ public function getServiceConfig() 'zfcuser_zend_db_adapter' => 'Zend\Db\Adapter\Adapter', ), 'invokables' => array( - 'zfcuser_user_service' => 'ZfcUser\Service\User', 'zfcuser_register_form_hydrator' => 'Zend\Stdlib\Hydrator\ClassMethods', ), 'factories' => array( @@ -90,6 +89,8 @@ public function getServiceConfig() 'ZfcUser\Authentication\Adapter\Db' => 'ZfcUser\Factory\Authentication\Adapter\DbFactory', 'ZfcUser\Authentication\Storage\Db' => 'ZfcUser\Factory\Authentication\Storage\DbFactory', + + 'zfcuser_user_service' => 'ZfcUser\Factory\Service\UserFactory', ), ); } diff --git a/src/ZfcUser/Service/User.php b/src/ZfcUser/Service/User.php index 81349c80..b865823c 100644 --- a/src/ZfcUser/Service/User.php +++ b/src/ZfcUser/Service/User.php @@ -4,7 +4,6 @@ use Zend\Authentication\AuthenticationService; use Zend\Form\Form; -use Zend\ServiceManager\ServiceManagerAwareInterface; use Zend\ServiceManager\ServiceManager; use Zend\Crypt\Password\Bcrypt; use Zend\Stdlib\Hydrator; @@ -12,7 +11,7 @@ use ZfcUser\Mapper\UserInterface as UserMapperInterface; use ZfcUser\Options\UserServiceOptionsInterface; -class User extends EventProvider implements ServiceManagerAwareInterface +class User extends EventProvider { /** From 3150e67873cc1e53b4a6b2b854758a0cd8979b29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Str=C3=B8m?= Date: Sat, 7 May 2016 13:13:13 +0200 Subject: [PATCH 3/3] Fix usage of servicelocator in UserControllerFactory --- .../Factory/Controller/UserControllerFactory.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/ZfcUser/Factory/Controller/UserControllerFactory.php b/src/ZfcUser/Factory/Controller/UserControllerFactory.php index 782ebfb6..88122b4d 100644 --- a/src/ZfcUser/Factory/Controller/UserControllerFactory.php +++ b/src/ZfcUser/Factory/Controller/UserControllerFactory.php @@ -35,12 +35,12 @@ public function createService(ServiceLocatorInterface $controllerManager) $controller = new UserController($redirectCallback); $controller->setServiceLocator($serviceManager); - $controller->setChangeEmailForm($this->serviceLocator->get('zfcuser_change_email_form')); - $controller->setOptions($this->serviceLocator->get('zfcuser_module_options')); - $controller->setChangePasswordForm($this->serviceLocator->get('zfcuser_change_password_form')); - $controller->setLoginForm($this->serviceLocator->get('zfcuser_login_form')); - $controller->setRegisterForm($this->serviceLocator->get('zfcuser_register_form')); - $controller->setUserService($this->serviceLocator->get('zfcuser_user_service')); + $controller->setChangeEmailForm($serviceManager->get('zfcuser_change_email_form')); + $controller->setOptions($serviceManager->get('zfcuser_module_options')); + $controller->setChangePasswordForm($serviceManager->get('zfcuser_change_password_form')); + $controller->setLoginForm($serviceManager->get('zfcuser_login_form')); + $controller->setRegisterForm($serviceManager->get('zfcuser_register_form')); + $controller->setUserService($serviceManager->get('zfcuser_user_service')); return $controller; }