From e8f43d08a68555b85b0b98093a010d7487a206ae Mon Sep 17 00:00:00 2001 From: rarog Date: Wed, 2 Sep 2020 01:31:49 +0200 Subject: [PATCH] Removing leftover references of Laminas\Hydrator\ClassMethods --- Module.php | 2 +- composer.json | 5 +++++ src/LmcUser/Factory/UserHydrator.php | 17 ++++------------- src/LmcUser/Mapper/AbstractDbMapper.php | 8 ++++---- src/LmcUser/Service/User.php | 2 +- .../Factory/Form/RegisterFormFactoryTest.php | 1 - 6 files changed, 15 insertions(+), 20 deletions(-) diff --git a/Module.php b/Module.php index 4a075b8..04ab937 100644 --- a/Module.php +++ b/Module.php @@ -55,7 +55,7 @@ public function getServiceConfig() 'lmcuser_laminas_db_adapter' => \Laminas\Db\Adapter\Adapter::class, ), 'invokables' => array( - 'lmcuser_register_form_hydrator' => \Laminas\Hydrator\ClassMethods::class, + 'lmcuser_register_form_hydrator' => \Laminas\Hydrator\ClassMethodsHydrator::class, ), 'factories' => array( 'lmcuser_redirect_callback' => \LmcUser\Factory\Controller\RedirectCallbackFactory::class, diff --git a/composer.json b/composer.json index 2592b45..b4b90fd 100644 --- a/composer.json +++ b/composer.json @@ -57,5 +57,10 @@ "classmap": [ "./Module.php" ] + }, + "autoload-dev": { + "psr-0": { + "LmcUserTest": "tests/" + } } } diff --git a/src/LmcUser/Factory/UserHydrator.php b/src/LmcUser/Factory/UserHydrator.php index 8821003..82c151b 100644 --- a/src/LmcUser/Factory/UserHydrator.php +++ b/src/LmcUser/Factory/UserHydrator.php @@ -4,24 +4,15 @@ use Interop\Container\ContainerInterface; use Laminas\ServiceManager\Factory\FactoryInterface; -use Laminas\ServiceManager\ServiceLocatorInterface; class UserHydrator implements FactoryInterface { - public function __invoke(ContainerInterface $container, $requestedName, array $options = null) - { - return new \Laminas\Hydrator\ClassMethods(); - } - - /** - * Create service - * - * @param ServiceLocatorInterface $serviceLocator - * @return mixed + * {@inheritDoc} + * @see \Laminas\ServiceManager\Factory\FactoryInterface::__invoke() */ - public function createService(ServiceLocatorInterface $serviceLocator) + public function __invoke(ContainerInterface $container, $requestedName, array $options = null) { - return $this->__invoke($serviceLocator, null); + return new \Laminas\Hydrator\ClassMethodsHydrator(); } } diff --git a/src/LmcUser/Mapper/AbstractDbMapper.php b/src/LmcUser/Mapper/AbstractDbMapper.php index ac13af5..99b7572 100644 --- a/src/LmcUser/Mapper/AbstractDbMapper.php +++ b/src/LmcUser/Mapper/AbstractDbMapper.php @@ -7,11 +7,11 @@ use Laminas\Db\Sql\Select; use Laminas\Db\Sql\Sql; use Laminas\Db\Sql\TableIdentifier; +use Laminas\Hydrator\ClassMethodsHydrator; use Laminas\Hydrator\HydratorInterface; -use Laminas\Hydrator\ClassMethods; +use LmcUser\Db\Adapter\MasterSlaveAdapterInterface; use LmcUser\Entity\UserInterface as UserEntityInterface; use LmcUser\EventManager\EventProvider; -use LmcUser\Db\Adapter\MasterSlaveAdapterInterface; abstract class AbstractDbMapper extends EventProvider { @@ -80,7 +80,7 @@ protected function initialize() throw new \Exception('No db adapter present'); } if (!$this->hydrator instanceof HydratorInterface) { - $this->hydrator = new ClassMethods; + $this->hydrator = new ClassMethodsHydrator(); } if (!is_object($this->entityPrototype)) { throw new \Exception('No entity prototype set'); @@ -243,7 +243,7 @@ public function setDbSlaveAdapter(Adapter $dbSlaveAdapter) public function getHydrator() { if (!$this->hydrator) { - $this->hydrator = new ClassMethods(false); + $this->hydrator = new ClassMethodsHydrator(false); } return $this->hydrator; } diff --git a/src/LmcUser/Service/User.php b/src/LmcUser/Service/User.php index 4cc2528..ddd4afb 100644 --- a/src/LmcUser/Service/User.php +++ b/src/LmcUser/Service/User.php @@ -288,7 +288,7 @@ public function setServiceManager(ContainerInterface $serviceManager) /** * Return the Form Hydrator * - * @return \Laminas\Hydrator\ClassMethods + * @return \Laminas\Hydrator\ClassMethodsHydrator */ public function getFormHydrator() { diff --git a/tests/LmcUserTest/Factory/Form/RegisterFormFactoryTest.php b/tests/LmcUserTest/Factory/Form/RegisterFormFactoryTest.php index 5ab97e6..eaa9c2e 100644 --- a/tests/LmcUserTest/Factory/Form/RegisterFormFactoryTest.php +++ b/tests/LmcUserTest/Factory/Form/RegisterFormFactoryTest.php @@ -4,7 +4,6 @@ use Laminas\Form\FormElementManager; use Laminas\Hydrator\ClassMethodsHydrator; use Laminas\ServiceManager\ServiceManager; -use Laminas\Hydrator\ClassMethods; use LmcUser\Factory\Form\Register as RegisterFactory; use LmcUser\Options\ModuleOptions; use LmcUser\Mapper\User as UserMapper;