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/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/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; } 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; + } +} 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 { /**