Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Problem with zfcuser_user_mapper, with module and custom user entity #102

Open
ghost opened this issue Jan 10, 2017 · 0 comments
Open

Problem with zfcuser_user_mapper, with module and custom user entity #102

ghost opened this issue Jan 10, 2017 · 0 comments

Comments

@ghost
Copy link

ghost commented Jan 10, 2017

Hello everyone, i have created a custom user module that extends zfcuser, also a custom entity for the user table, and make all the necessary changes for the integration. But my problem is when trying to authenticate myself, I get this error:

An alias "Zend\Db\Adapter\Adapter" was requested but no service could be found

This happens when zfcuser_user_mapper attempts to change the adapter.

Note: I am not very clear why I need to use the Zend \ Db \ Adapter \ Adapter, since I am working with doctrine.
This is the code in the module.php of the custom user module.
public function getServiceConfig() { return [ 'aliases' => array( 'zfcuser_zend_db_adapter' => 'Zend\Db\Adapter\Adapter', ), 'factories' => [ 'usuario_login_form' => 'Usuario\Factory\Form\Login', 'usuario_registro_form' => 'Usuario\Factory\Form\Register', 'usuario_user_service' => 'Usuario\Factory\Service\UserFactory', //'usuario_user_mapper' => 'Usuario\Factory\Mapper\User', 'usuario_auth_service' => 'Usuario\Factory\AuthenticationService', 'Usuario\Authentication\Adapter\Db' => 'Usuario\Factory\Authentication\Adapter\DbFactory', 'Usuario\Authentication\Storage\Db' => 'Usuario\Factory\Authentication\Storage\DbFactory', //'Zend\Db\Adapter\Adapter' => 'Zend\Db\Adapter\Adapter', 'usuario_user_mapper' => function ($sm) { $mapper = new Mapper\User(); $mapper->setDbAdapter($sm->get('zfcuser_zend_db_adapter')); $mapper->setEntityPrototype(new ORM\Entity\Usuarios()); $mapper->setHydrator(new \ZfcUser\Mapper\UserHydrator()); return $mapper; }, ] ]; }

This is my global.php file

return array( 'doctrine' => array( 'connection' => array( 'orm_default' => array( 'driverClass' => 'Doctrine\DBAL\Driver\PDOMySql\Driver', 'params' => array( 'host' => 'localhost', 'port' => '3306', 'user' => 'root', 'password' => 'toor', 'dbname' => 'deporte', ) ) ) ), );

This is my module.config.php file:

'controllers' => array( ), 'doctrine' => array( 'driver' => array( // overriding zfc-user-doctrine-orm's config 'usuario_entity' => array( 'class' => 'Doctrine\ORM\Mapping\Driver\AnnotationDriver', 'paths' => __DIR__ . '/../src/Usuario/ORM/Entity', ), 'orm_default' => array( 'drivers' => array( 'Usuario\ORM\Entity' => 'usuario_entity', ), ), ), ), 'zfcuser' => array( 'auth_adapters' => array(100 => 'Usuario\Authentication\Adapter\Db'), // telling ZfcUser to use our own class 'user_entity_class' => 'Usuario\ORM\Entity\Usuarios', // telling ZfcUserDoctrineORM to skip the entities it defines 'enable_default_entities' => false, ),

I thank you for the help, I have already been with this error for days. Thank you very much, and excuse my English.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants