I am looking for a way to check if the connection with doctrine 2 works.
Because in my application, users can independently change information connections. I want to check if the user has entered the correct login and correct password.
How can i do this?
I tried putting this code in a try / catch block:
try{ $entityManager = $this->getEntityManager() ; $repository = $entityManager->getRepository('Authentification\Entity\User'); $userToIdentify = $repository->findOneBy(array('login' => $this->_username, 'password' => $this->_password)); }catch(Exception $e){ $code = Result::FAILURE ; $identity = "unknow" ; $messages = array( "message" => "Mauvaise combinaison de login/password", ) ; }
The problem is that even if the information connections are correct, I cannot catch the exception.
Otherwise, I have this error:
<b>Fatal error</b>: Uncaught exception 'Zend\View\Exception\RuntimeException' with message 'Zend\View\Renderer\PhpRenderer::render: Unable to render template "layout/layout"; resolver could not resolve to a file' in C:\xampp\htdocs\poemsV3\vendor\zendframework\zendframework\library\Zend\View\Renderer\PhpRenderer.php:451 Stack trace: #0 C:\xampp\htdocs\poemsV3\vendor\zendframework\zendframework\library\Zend\View\View.php(203): Zend\View\Renderer\PhpRenderer->render(Object(Zend\View\Model\ViewModel)) #1 C:\xampp\htdocs\poemsV3\vendor\zendframework\zendframework\library\Zend\Mvc\View\Http\DefaultRenderingStrategy.php(128): Zend\View\View->render(Object(Zend\View\Model\ViewModel)) #2 [internal function]: Zend\Mvc\View\Http\DefaultRenderingStrategy->render(Object(Zend\Mvc\MvcEvent))#3 C:\xampp\htdocs\poemsV3\vendor\zendframework\zendframework\library\Zend\EventManager\EventManager.php(469): call_user_func(Array, Object(Zend\Mvc\MvcEvent))#4 C:\xampp\htdocs\poemsV3\vendor\zendframework\zendframework\library\Zend\EventManager\EventMa in <b>C:\xampp\htdocs\poemsV3\vendor\zendframework\zendframework\library\Zend\View\Renderer\PhpRenderer.php</b> on line <b>451</b><br />
Do you have any ideas on how I can check if the connection works?
Thanks.
source share