Doctrine can't find entity - doctrine-orm

Doctrine cannot find my entity in models folder of project.
Test file:
<?php
use Doctrine\ORM\Tools\Setup;
use Doctrine\ORM\EntityManager;
require_once "vendor/autoload.php";
$isDevMode = true;
$config = Setup::createAnnotationMetadataConfiguration(array("models"), $isDevMode);
$dbParams = array(
'driver' => 'pdo_mysql',
'user' => '',
'password' => '',
'dbname' => '',
);
$entityManager = EntityManager::create($dbParams, $config);
try {
/** #var \models\Vars $repo */
$repo = $entityManager->getRepository('Vars');
echo 'success';
} catch (Exception $e) {
echo $e->getMessage();
}
models/Vars:
<?php
namespace models;
use Doctrine\ORM\Annotation as ORM;
/**
* #ORM\Entity(name="Vars")
* #ORM\Table(name="vars")
*/
class Vars
{
}
Im newbie in php. Anyway thanks.

Solved. I just remove namespace from entity and now all works. But is it correct solution?

Related

Doctrine DQL Extention not working in Zend Framework 2

I have just added a DQL extension into my ZF2 app but it is not working.
The extension should allow a match against query.
In my module.config.php I have
'doctrine' => array(
'driver' => array(
'Application_driver' => array(
'class' => 'Doctrine\ORM\Mapping\Driver\AnnotationDriver',
'cache' => 'array',
'paths' => array(__DIR__ . '/../src/Application/Entity')
),
'orm_default' => array(
'drivers' => array(
'Application\Entity' => 'Application_driver'
),
),
),
'configuration' => array(
'orm_default' => array(
'string_functions' => array(
'MatchAgainst' => 'Freedom\Doctrine\ORM\AST\Functions\MatchAgainstFunction',
),
'datetime_functions' => array(),
'numeric_functions' => array(),
'metadata_cache' => 'filesystem',
'query_cache' => 'filesystem',
'result_cache' => 'filesystem',
),
),
),
and in my DQL I have
$builder->andwhere('MATCH (`t.title`) AGAINST (:title)')
->setParameter('title', $param);
The extension is not even being executed all I get is an error.
Error: Expected known function, got 'MATCH'
Does anyone know what I am missing?
Many thanks in advance.
EDIT
I have got the extension working by changing the line from 'MatchAgainst' => 'Freedom\Doctrine\ORM\AST\Functions\MatchAgainstFunction', to 'Match' => 'Freedom\Doctrine\ORM\AST\Functions\MatchAgainstFunction',.
The problem I am having now is the DQL query is still not working.
My DQL extension looks like
namespace Freedom\Doctrine\ORM\AST\Functions;
use Doctrine\ORM\Query\AST\Functions\FunctionNode;
use Doctrine\ORM\Query\Lexer;
use Doctrine\ORM\Query\Parser;
use Doctrine\ORM\Query\SqlWalker;
/**
* MatchAgainstFunction ::=
* "MATCH" "(" StateFieldPathExpression {"," StateFieldPathExpression}* ")" "AGAINST" "("
* StringPrimary ["BOOLEAN"] ["EXPAND"] ")"
*/
class MatchAgainstFunction extends FunctionNode
{
/** #var array list of \Doctrine\ORM\Query\AST\PathExpression */
protected $pathExp = null;
/** #var string */
protected $against = null;
/** #var boolean */
protected $booleanMode = false;
/** #var boolean */
protected $queryExpansion = false;
public function parse(Parser $parser)
{
// match
$parser->match(Lexer::T_IDENTIFIER);
$parser->match(Lexer::T_OPEN_PARENTHESIS);
// first Path Expression is mandatory
$this->pathExp = array();
$this->pathExp[] = $parser->StateFieldPathExpression();
// Subsequent Path Expressions are optional
$lexer = $parser->getLexer();
while ($lexer->isNextToken(Lexer::T_COMMA)) {
$parser->match(Lexer::T_COMMA);
$this->pathExp[] = $parser->StateFieldPathExpression();
}
$parser->match(Lexer::T_CLOSE_PARENTHESIS);
// against
if (strtolower($lexer->lookahead['value']) !== 'against') {
$parser->syntaxError('against');
}
$parser->match(Lexer::T_IDENTIFIER);
$parser->match(Lexer::T_OPEN_PARENTHESIS);
$this->against = $parser->StringPrimary();
if (strtolower($lexer->lookahead['value']) === 'boolean') {
$parser->match(Lexer::T_IDENTIFIER);
$this->booleanMode = true;
}
if (strtolower($lexer->lookahead['value']) === 'expand') {
$parser->match(Lexer::T_IDENTIFIER);
$this->queryExpansion = true;
}
$parser->match(Lexer::T_CLOSE_PARENTHESIS);
}
public function getSql(SqlWalker $walker)
{
$fields = array();
foreach ($this->pathExp as $pathExp) {
$fields[] = $pathExp->dispatch($walker);
}
$against = $walker->walkStringPrimary($this->against)
. ($this->booleanMode ? ' IN BOOLEAN MODE' : '')
. ($this->queryExpansion ? ' WITH QUERY EXPANSION' : '');
return sprintf('MATCH (%s) AGAINST (%s)', implode(', ', $fields), $against);
}
}
and in my DQL I have
$builder->andWhere('MATCH (t.title) AGAINST (:title)')
->setParameter('title', $param);
Now I am getting the error
[Syntax Error] line 0, col 204: Error: Expected =, <, <=, <>, >, >=, !=, got 'ORDER'
Does anyone know why Doctrine is looking for a comparison operator?
I have got the extension working by changing the line from 'MatchAgainst' => 'Freedom\Doctrine\ORM\AST\Functions\MatchAgainstFunction', to 'Match' => 'Freedom\Doctrine\ORM\AST\Functions\MatchAgainstFunction',
In answer to my second question I found this works
$builder->andWhere('MATCH (t.title) AGAINST (:title BOOLEAN) > 0')
->setParameter('title', $param);

Zend 2 Doctrine 2 Gedmo Translatable

I am trying to use the Gedmo translatable extension for Doctrine 2 in a Zend Framework 2 application.
I have it setup like this:
'doctrine' => array(
'eventmanager' => array(
'orm_default' => array(
'subscribers' => array(
'Gedmo\Translatable\TranslatableListener'
)
)
),
'driver' => array(
'application_entities' => array(
'class' => 'Doctrine\ORM\Mapping\Driver\AnnotationDriver',
'cache' => 'array',
'paths' => array(__DIR__ . '/../src/Application/Entity')
),
'translatable_metadata_driver' => array(
'class' => 'Doctrine\ORM\Mapping\Driver\AnnotationDriver',
'cache' => 'array',
'paths' => array(
'vendor/gedmo/doctrine-extensions/lib/Gedmo/Translatable/Entity',
)
),
'orm_default' => array(
'drivers' => array(
'Application\Entity' => 'application_entities',
'Gedmo\Translatable\Entity' => 'translatable_metadata_driver'
)
)
),
),
Sample Entity:
<?php
namespace Application\Entity;
use Gedmo\Mapping\Annotation as Gedmo;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
/**
* #ORM\Entity (repositoryClass="Application\Repository\CategoryRepository")
*/
class Category {
/**
* #ORM\Id
* #ORM\GeneratedValue
* #ORM\Column(type="integer")
*/
private $id;
/**
* #ORM\Column(type="string")
* #Gedmo\Translatable
*/
private $name;
/**
* #Gedmo\Locale
*/
private $locale;
}
Persisting translations works fine and I can get them using the translatable repository.
I have two problems:
I cannot figure out how to get the translatable listener subscribed to the entitymanager. I would like to get it in the Module class to set the default locale on bootstrap.
When I have an entity object I cannot get the translations of translatable columns, only the standard values. As far as I can figure out, I should get a value translated to the default locale, and should be able to override the default locale by setting a variable in the Entity annotated with Locale, but it does not seem to work.
Any help would be greatly appreciated!
public function onBootstrap(MvcEvent $event)
{
$serviceManager = $event->getApplication()->getServiceManager();
$this->prepareGedmoTranslatable($serviceManager);
}
/**
* Does initial config of Gedmo\TranslatableListener
* sets default locale and registers it as service
*
* Reader you can ask why?
* You will understand me if you try to use TranslatableListener yourself ;)
*
* #param ContainerInterface $services
*/
public function prepareGedmoTranslatable(ContainerInterface $services)
{
/**
* #var EventManager $ormEventManager
*/
$ormEventManager = $services->get('doctrine.eventmanager.orm_default');
// assume that postLoad event has TranslatableListener as listener
// it will be if TranslatableListener enabled in doctrine config
// Doctrine\ORM\Events::postLoad
$listeners = $ormEventManager->getListeners(Events::postLoad);
$translatableListener = null;
// search for TranslatableListener cause Gedmo loves hardcore stuff ;)
foreach ($listeners as $listener) {
if ($listener instanceof TranslatableListener) {
$translatableListener = $listener;
break;
}
}
if ($translatableListener instanceof TranslatableListener) {
$translatableListener->setDefaultLocale(
// assume that translator config provides default locale
// e.g locale that have been set in config
$services->get('config')['translator']['locale']
);
// let translations to fallback to default locale
$translatableListener->getTranslationFallback(true);
// lines below adds Listener as a service so you can access it by
// $services->get(TranslatableListener::class)
// everywhere you want
$services->setAllowOverride(true);
$services->setService(TranslatableListener::class, $translatableListener);
$services->setAllowOverride(false);
}
}
Glad to help you!

ZF2 inputfilter doctrine NoObjectExists editing object does not validate

So i got a ZF2 application, got a Form and a InputFilter in the InputFilter i have:
$this->add(
array(
'name' => 'email',
'required' => true,
'validators' => array(
array(
'name' => 'EmailAddress'
),
array(
'name' => 'DoctrineModule\Validator\NoObjectExists',
'options' => array(
'object_repository' => $sm->get('doctrine.entitymanager.orm_default')->getRepository('YrmUser\Entity\User'),
'fields' => 'email'
),
),
),
)
);
works great, however when i edit a existing object and save it the NoObjectExists validator says a matching object is found so it doesn't validate.
Is there a solution to this problem?
Or should i just remove the validator on the edit form and catch the exception when a duplicate is inserted?
UPDATE:
How to use DoctrineModule\Validator\NoObjectExists in edit forms - Zend Framework 2 & Doctrine 2
is the same issue but the answer is to just remove the validator on editing, this off-course is not a solution. As you would still have to catch the exception thrown for when inserting a duplicate. I could do that no problem but what im asking for is a solution to make it work WITH NoObjectExists (otherwise whats the use of this validator if i have to catch the exception for duplicates anyway)
UPDATE, added other relevant code (my form and entity have more fields than this but i removed them to keep it readable on here)
FORM:
namespace YrmUser\Form;
use Zend\Form\Form;
use DoctrineModule\Stdlib\Hydrator\DoctrineObject as DoctrineHydrator;
use DoctrineORMModule\Stdlib\Hydrator\DoctrineEntity;
use YrmUser\Entity\User;
class UserForm extends Form
{
protected $objectManager;
/**
* __construct description
*
* #param String $name form name
*
* #return void
*/
public function __construct($name = null)
{
parent::__construct('new-user');
}
public function init()
{
$this->setHydrator(
new DoctrineHydrator($this->objectManager, 'YrmUser\Entity\User')
)->setObject(new User());
$this->setAttribute('method', 'post');
$this->add(
array(
'name' => 'email',
'attributes' => array(
'type' => 'email',
'placeholder' =>'Email',
),
'options' => array(
'label' => 'Email',
),
)
);
}
}
FILTER:
class UserFilter extends InputFilter
{
/**
* [__construct description]
*
* #param ServiceLocator $sm servicelocator
*/
public function __construct($sm)
{
$this->add(
array(
'name' => 'email',
'required' => true,
'validators' => array(
array(
'name' => 'EmailAddress'
),
array(
'name' => 'DoctrineModule\Validator\NoObjectExists',
'options' => array(
'object_repository' => $sm->get('doctrine.entitymanager.orm_default')->getRepository('YrmUser\Entity\User'),
'fields' => 'email'
),
),
),
)
);
}
}
CONTROLLER ACTION:
public function editAction()
{
$id = (int) $this->params('id', null);
if (null === $id) {
return $this->redirect()->toRoute('manage-users');
}
$em = $this->getServiceLocator()->get('Doctrine\ORM\EntityManager');
$formManager = $this->getServiceLocator()->get('FormElementManager');
$form = $formManager->get('UserForm');
$user = $em->find('YrmUser\Entity\User', $id);
$form->setInputFilter(new UserFilter($this->getServiceLocator()));
$form->bind($user);
$request = $this->getRequest();
if ($request->isPost()) {
$form->setData($request->getPost());
if ($form->isValid()) {
$em->persist($user);
$em->flush();
return $this->redirect()->toRoute('manage-users');
}
}
return array(
'form' => $form,
'id' => $id
);
}
ENTITY:
class User
{
/**
* #var int
* #ORM\Id
* #ORM\Column(type="integer")
* #ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* #var string
* #ORM\Column(type="string", unique=true, length=255)
*/
protected $email;
/**
* Get id.
*
* #return int
*/
public function getId()
{
return $this->id;
}
/**
* Set id.
*
* #param int $id user id
*
* #return void
*/
public function setId($id)
{
$this->id = (int) $id;
}
/**
* Get email.
*
* #return string
*/
public function getEmail()
{
return $this->email;
}
/**
* Set email.
*
* #param string $email user email adress
*
* #return void
*/
public function setEmail($email)
{
$this->email = $email;
}
}
thanks in advance,
Yrm
I lately had the same issue on my project, I spend lot of time searching for a solution and I've finally found this module LosBase.
It uses two customs validators which extend DoctrineModule\Validator\NoObjectExists : NoEntityExists for Add action and NoOtherEntityExists for Edit action.
So I used this appraoch to resolve my problem. This is the solution I've made so far :
NoOtherEntityExists validator :
use Zend\Validator\Exception\InvalidArgumentException;
use DoctrineModule\Validator\NoObjectExists;
class NoOtherEntityExists extends NoObjectExists
{
private $id; //id of the entity to edit
private $id_getter; //getter of the id
private $additionalFields = null; //other fields
public function __construct(array $options)
{
parent::__construct($options);
if (isset($options['additionalFields'])) {
$this->additionalFields = $options['additionalFields'];
}
$this->id = $options['id'];
$this->id_getter = $options['id_getter'];
}
public function isValid($value, $context = null)
{
if (null != $this->additionalFields && is_array($context)) {
$value = (array) $value;
foreach ($this->additionalFields as $field) {
$value[] = $context[$field];
}
}
$value = $this->cleanSearchValue($value);
$match = $this->objectRepository->findOneBy($value);
if (is_object($match) && $match->{$this->id_getter}() != $this->id) {
if (is_array($value)) {
$str = '';
foreach ($value as $campo) {
if ($str != '') {
$str .= ', ';
}
$str .= $campo;
}
$value = $str;
}
$this->error(self::ERROR_OBJECT_FOUND, $value);
return false;
}
return true;
}
}
NoEntityExists validator :
use Zend\Validator\Exception\InvalidArgumentException;
use DoctrineModule\Validator\NoObjectExists;
class NoEntityExists extends NoObjectExists
{
private $additionalFields = null;
public function __construct(array $options)
{
parent::__construct($options);
if (isset($options['additionalFields'])) {
$this->additionalFields = $options['additionalFields'];
}
}
public function isValid($value, $context = null)
{
if (null != $this->additionalFields && is_array($context)) {
$value = (array) $value;
foreach ($this->additionalFields as $field) {
$value[] = $context[$field];
}
}
$value = $this->cleanSearchValue($value);
$match = $this->objectRepository->findOneBy($value);
if (is_object($match)) {
if (is_array($value)) {
$str = '';
foreach ($value as $campo) {
if ($str != '') {
$str .= ', ';
}
$str .= $campo;
}
$value = $str;
}
$this->error(self::ERROR_OBJECT_FOUND, $value);
return false;
}
return true;
}
}
Using this validators with inputFilter :
In my custom input filters, I added two methods : one to append the NoEntityExists validator, and the other to append the NoOtherEntityExists validator :
/**
* Appends doctrine's NoObjectExists Validator for Add FORM .
*
* #param \Doctrine\ORM\EntityRepository $repository
* #return \Zend\InputFilter\InputFilter
*/
public function appendAddValidator(EntityRepository $repository)
{
$this->add($this->getFactory()->createInput( array(
'name' => 'libellesite', //unique field name
'validators' => array(
array(
'name' => 'Netman\Form\NoEntityExists',//use namespace
'options' => array(
'object_repository' => $repository,
'fields' => 'libellesite',
'messages' => array(
'objectFound' => 'custom message here'
),
),
),
)
)));
return $this;
}
/**
* Appends doctrine's NoObjectExists Validator for EDIT FORM.
*
* #param \Doctrine\ORM\EntityRepository $repository
* #return \Zend\InputFilter\InputFilter
*/
public function appendEditValidator(EntityRepository $repository, $id)
{
$this->add($this->getFactory()->createInput( array(
'name' => 'libellesite',
'validators' => array(
array(
'name' => 'Netman\Form\NoOtherEntityExists',
'options' => array(
'object_repository' => $repository,
'fields' => 'libellesite',
'id'=>$id, //
'id_getter'=>'getCodesite',//getter for ID
'messages' => array(
'objectFound' => 'custom message here'
),
),
),
)
)));
return $this;
}
Controller :
In the addAction :
$repository = $em->getRepository('Entity\Name');
$form->setInputFilter($filter->appendAddValidator($repository));
In the editAction :
$id = $this->params('id', null);
$repository = $em->getRepository('Entity\Name');
$form->setInputFilter($filter->appendEditValidator($repository,$id));

zend framework 2 Unable to render template resolver could not resolve to a file

I'm learning how to use Zend Framework2. According to some tutorials available on the Net I've wrote some pieces of code . The most important tutorial for me is this one: https://github.com/psamatt/zf2-doctrine-example It covers most of the basics that i've planned to write. I've stuck on one problem that looks strange to me. On my summary page, that display all the records from DB I have a links to add new record, edit existing record, and delete record. Routing is covered by module.config.php:
'router' => array(
'routes' => array(
'incident' => array(
'type' => 'segment',
'options' => array(
'route' => '/incident[/][:action][/:id]',
'constraints' => array(
'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
'id' => '[0-9]+',
),
'defaults' => array(
'controller' => 'Helpdesk\Controller\Incident',
'action' => 'index',
),
),
),
),
),
When I use a link to a new record (h.t.t.p://helpdesk/incident/add) everything works correctly. But when I use a link to edit my record (h.t.t.p://helpdesk/incident/edit/1 - where 1 is example record ID) I receive an error:
Zend\View\Renderer\PhpRenderer::render: Unable to render template "helpdesk/incident/edit"; resolver could not resolve to a file
This is my IncidentController.php:
<?php
namespace Helpdesk\Controller;
use Application\Controller\EntityUsingController;
use DoctrineModule\Stdlib\Hydrator\DoctrineObject;
use Doctrine\ORM\EntityManager;
use Zend\View\Model\ViewModel;
use Helpdesk\Form\IncidentForm;
use Helpdesk\Entity\Incident;
class IncidentController extends EntityUsingController
{
/**
* Index action
*
*/
public function indexAction()
{
$em = $this->getEntityManager();
$incidents = $em->getRepository('Helpdesk\Entity\Incident')->findAll();
return new ViewModel(array(
'incidents' => $incidents
));
}
/**
* Edit action
*
*/
public function editAction()
{
$incident = new Incident();
if ($this->params('id') > 0) {
$incident = $this->getEntityManager()->getRepository('Helpdesk\Entity\Incident')->find($this->params('id'));
}
$form = new IncidentForm($this->getEntityManager());
$form->bind($incident);
$form->setHydrator(new DoctrineObject($this->getEntityManager(),'Helpdesk\Entity\Incident'));
$request = $this->getRequest();
if ($request->isPost()) {
$form->setInputFilter($incident->getInputFilter());
$form->setData($request->getPost());
if ($form->isValid()) {
$em = $this->getEntityManager();
$em->persist($incident);
$em->flush();
$this->flashMessenger()->addSuccessMessage('Incident saved');
// Redirect to list of incidents
return $this->redirect()->toRoute('incident');
}
}
return array(
'incident' => $incident,
'form' => $form,
);
}
/**
* Add action
*
*/
public function addAction()
{
return $this->editAction();
}
/**
* Delete action
*
*/
public function deleteAction()
{
$id = (int)$this->getEvent()->getRouteMatch()->getParam('id');
if (!$id) {
return $this->redirect()->toRoute('incident');
}
$request = $this->getRequest();
if ($request->isPost()) {
$del = $request->post()->get('del', 'No');
if ($del == 'Yes') {
$id = (int)$request->post()->get('id');
$incident = $this->getEntityManager()->find('Helpdesk\Entity\Incident', $id);
if ($incident) {
$this->getEntityManager()->remove($incident);
$this->getEntityManager()->flush();
}
}
// Redirect to list of incidents
return $this->redirect()->toRoute('default', array(
'controller' => 'incident',
'action' => 'index',
));
}
return array(
'id' => $id,
'incident' => $this->getEntityManager()->find('Helpdesk\Entity\Incident', $id)->getArrayCopy()
);
}
}
What is the difference between these two? Why one works fine, while the second one generates an error?
Thanks for your help
Smok.
Most likely helpdesk/incident/edit.phtml does not exist, while add action is rendering an existing helpdesk/incident/add.phtml.
You can reuse the existing helpdesk/incident/add.phtml or create a new one.

Possible database configuration problems

I'm a new Zend developper and I have got some conception problem's (especially with doctrine).
I've got a Class which is called MyAuthenticationProcess.
This class is trying to authenticate an User by verifiying his identity on a Database.
As I saw over the internet, I should implement 3 things in order to communicate with my dataBase.
First of all, I have to add those lines in my module.config.php
'doctrine' => array(
'driver' => array(
__NAMESPACE__. '_driver' => array(
'class' => 'Doctrine\ORM\Mapping\Driver\AnnotationDriver',
'cache' => 'array',
'paths' => array(__DIR__ . '/../src/' . __NAMESPACE__ . '/Entity')
),
'orm_default' => array(
'drivers' => array(
__NAMESPACE__.'\Entity' => __NAMESPACE__.'_driver'
)
)
)
),
Secondly I have to create a file which will contains my Entity. I created this file in Authentification/Entity/User.php
Here is the code of this file :
<?php
namespace Authentification\Entity;
use Doctrine\ORM\Mapping as ORM;
use Zend\InputFilter\InputFilter;
use Zend\InputFilter\Factory as InputFactory;
use Zend\InputFilter\InputFilterAwareInterface;
use Zend\InputFilter\InputFilterInterface;
/**
* A User table.
*
* #ORM\Entity
* #ORM\Table(name="user")
* #property string $login
* #property string $password
* #property int $id
*/
class User {
/**
* #ORM\Id
* #ORM\Column(type="integer");
* #ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* #ORM\Column(type="string")
*/
protected $login;
/**
* #ORM\Column(type="string")
*/
protected $password;
/**
* Magic getter to expose protected properties.
*
* #param string $property
* #return mixed
*/
public function __get($property)
{
return $this->$property;
}
/**
* Magic setter to save protected properties.
*
* #param string $property
* #param mixed $value
*/
public function __set($property, $value)
{
$this->$property = $value;
}
}
?>
And to finish I added this configuration into this file : config/autoload/local.php
<?php
return array(
'doctrine' => array(
'connection' => array(
'orm_default' => array(
'driverClass' => 'Doctrine\DBAL\Driver\PDOMySql\Driver',
'params' => array(
'host' => 'localhost',
'port' => '3306',
'user' => 'root',
'password' => '',
'dbname' => 'zf2tutorial',
)
)
)
),
);
The problem that I have now is for accessing to my dataBase.
I guess it's a problem of configuration.
In my class MyAuthenticationProcess I'm trying to get all the entries of my table "User". But I can't.
Here is the code that I used to do so :
$users = $this->getEntityManager()->getRepository('Authentification\Entity\User')->findAll() ;
var_dump($users) ;
And here is the error that I get :
<br />
<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 xampp\htdocs\kjsencha\vendor\zendframework\zendframework\library\Zend\View\Renderer\PhpRenderer.php:457
Stack trace:
#0 xampp\htdocs\kjsencha\vendor\zendframework\zendframework\library\Zend\View\View.php(201): Zend\View\Renderer\PhpRenderer->render(Object(Zend\View\Model\ViewModel))
#1 xampp\htdocs\kjsencha\vendor\zendframework\zendframework\library\Zend\Mvc\View\Http\DefaultRenderingStrategy.php(126): Zend\View\View->render(Object(Zend\View\Model\ViewModel))
#2 [internal function]: Zend\Mvc\View\Http\DefaultRenderingStrategy->render(Object(Zend\Mvc\MvcEvent))
#3 xampp\htdocs\kjsencha\vendor\zendframework\zendframework\library\Zend\EventManager\EventManager.php(460): call_user_func(Array, Object(Zend\Mvc\MvcEvent)) in <b>\xampp\htdocs\kjsencha\vendor\zendframework\zendframework\library\Zend\View\Renderer\PhpRenderer.php</b> on line <b>457</b><br />
To make sure that is a problem of configuration I tried to know if the connection was established by using this :
$users = $this->getEntityManager()->getConnection() ;
var_dump($users) ;
I was surprise to see that users equals to NULL.
Do you have any idea where the problem came from ?
Thank you for your help.
I finally found where my problem came from =D
It was my table structure in my database. It was not similar to my entity files, so I change it and now it work.
Hope my post will help someone else which has the same problem.