cdli / CdliTwoStageSignup

Two-stage signup process for ZfcUser. Supports Zend\Db and Doctrine! Now up-to-date with latest ZfcUser (as of Oct 24th, 2012)
Other
19 stars 13 forks source link

Unable to fetch or create an instance for cdlitwostagesignup_ev_modelmapper #9

Closed dperjar closed 11 years ago

dperjar commented 11 years ago

Been fighting this issue for a while now and can't seem to find a fix. After installation and configuration according to the readme trying to access the /register route throws the following error:

Zend\ServiceManager\Exception\ServiceNotFoundException

File: C:\wamp\www\FolioFiler\ZendPAC\vendor\zendframework\zendframework\library\Zend\ServiceManager\ServiceManager.php:456

Message: Zend\ServiceManager\ServiceManager::get was unable to fetch or create an instance for cdlitwostagesignup_ev_modelmapper

Stack trace: 0 C:\wamp\www\FolioFiler\ZendPAC\vendor\CdliTwoStageSignup\Module.php(81): Zend\ServiceManager\ServiceManager->get('cdlitwostagesig...') 1 [internal function]: CdliTwoStageSignup{closure}(Object(Zend\ServiceManager\ServiceManager), 'cdlitwostagesig...', 'cdlitwostagesig...') 2 C:\wamp\www\FolioFiler\ZendPAC\vendor\zendframework\zendframework\library\Zend\ServiceManager\ServiceManager.php(737): call_user_func(Object(Closure), Object(Zend\ServiceManager\ServiceManager), 'cdlitwostagesig...', 'cdlitwostagesig...') 3 C:\wamp\www\FolioFiler\ZendPAC\vendor\zendframework\zendframework\library\Zend\ServiceManager\ServiceManager.php(869): Zend\ServiceManager\ServiceManager->createServiceViaCallback(Object(Closure), 'cdlitwostagesig...', 'cdlitwostagesig...') 4 C:\wamp\www\FolioFiler\ZendPAC\vendor\zendframework\zendframework\library\Zend\ServiceManager\ServiceManager.php(494): Zend\ServiceManager\ServiceManager->createFromFactory('cdlitwostagesig...', 'cdlitwostagesig...') 5 C:\wamp\www\FolioFiler\ZendPAC\vendor\zendframework\zendframework\library\Zend\ServiceManager\ServiceManager.php(441): Zend\ServiceManager\ServiceManager->create(Array) 6 C:\wamp\www\FolioFiler\ZendPAC\vendor\CdliTwoStageSignup\src\CdliTwoStageSignup\Controller\RegisterController.php(149): Zend\ServiceManager\ServiceManager->get('cdlitwostagesig...') 7 C:\wamp\www\FolioFiler\ZendPAC\vendor\CdliTwoStageSignup\src\CdliTwoStageSignup\Controller\RegisterController.php(22): CdliTwoStageSignup\Controller\RegisterController->getEmailVerificationService() 8 C:\wamp\www\FolioFiler\ZendPAC\vendor\zendframework\zendframework\library\Zend\Mvc\Controller\AbstractActionController.php(83): CdliTwoStageSignup\Controller\RegisterController->emailVerificationAction() 9 [internal function]: Zend\Mvc\Controller\AbstractActionController->onDispatch(Object(Zend\Mvc\MvcEvent)) 10 C:\wamp\www\FolioFiler\ZendPAC\vendor\zendframework\zendframework\library\Zend\EventManager\EventManager.php(460): call_user_func(Array, Object(Zend\Mvc\MvcEvent)) 11 C:\wamp\www\FolioFiler\ZendPAC\vendor\zendframework\zendframework\library\Zend\EventManager\EventManager.php(204): Zend\EventManager\EventManager->triggerListeners('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure)) 12 C:\wamp\www\FolioFiler\ZendPAC\vendor\zendframework\zendframework\library\Zend\Mvc\Controller\AbstractController.php(117): Zend\EventManager\EventManager->trigger('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure)) 13 C:\wamp\www\FolioFiler\ZendPAC\vendor\zendframework\zendframework\library\Zend\Mvc\DispatchListener.php(114): Zend\Mvc\Controller\AbstractController->dispatch(Object(Zend\Http\PhpEnvironment\Request), Object(Zend\Http\PhpEnvironment\Response)) 14 [internal function]: Zend\Mvc\DispatchListener->onDispatch(Object(Zend\Mvc\MvcEvent)) 15 C:\wamp\www\FolioFiler\ZendPAC\vendor\zendframework\zendframework\library\Zend\EventManager\EventManager.php(460): call_user_func(Array, Object(Zend\Mvc\MvcEvent)) 16 C:\wamp\www\FolioFiler\ZendPAC\vendor\zendframework\zendframework\library\Zend\EventManager\EventManager.php(204): Zend\EventManager\EventManager->triggerListeners('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure)) 17 C:\wamp\www\FolioFiler\ZendPAC\vendor\zendframework\zendframework\library\Zend\Mvc\Application.php(295): Zend\EventManager\EventManager->trigger('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure)) 18 C:\wamp\www\FolioFiler\ZendPAC\public\index.php(16): Zend\Mvc\Application->run() 19 {main}

dperjar commented 11 years ago

Found a solution in seemingly unrelated issue #1

Getting rid of the .dist file extension on config/autoload/cdlitwostagesignup.global.php.dist fixed the problem. Not sure if I've got another underlying issue or this is a result to updates in ZF2?

adamlundrigan commented 11 years ago

This is due to the way the module supports both Zend\Db and Doctrine; to choose between the two a service manager alias cdlitwostagesignup_ev_modelmapper is configured via the config file. If the config file has a .dist extension it will not be loaded, which means that SM alias isn't created and so a ServiceNotFoundException is raised.