The code below has been working fine on my production server for sometime now. But now suddenly throws QueryException.
Fatal error: Uncaught exception 'Doctrine\ORM\Query\QueryException' with message 'SELECT c, m, u, t FROM Invetico\ContentBundle\Entity\Serminar c LEFT JOIN c.menu m LEFT JOIN c.user u LEFT JOIN c.term t WHERE t.slug = :slug AND c.status = :status ORDER BY c.datePublished DESC' in /home/zibaconsult/vendor/doctrine/orm/lib/Doctrine/ORM/Query/QueryException.php:41
The strange thing is on my developement machine nothing happens. No Fatal errors.
Below is the code
private function getContentQuery($contentType = '')
{
$qb = $this->_em->createQueryBuilder();
$class = ($contentType !='')?$contentType:'Invetico\ContentBundle\Entity\Content';
$qb->select('c','m','u','t')
->from($class, 'c')
->leftJoin('c.menu','m')
->leftJoin('c.user', 'u')
->leftJoin('c.term', 't');
return $qb;
}
public function findContentTypeByTerm($contentType, $term, $limit)
{
$qb = $this->getContentQuery($contentType)
->where('t.slug = :slug')
->andWhere('c.status = :status')
->orderBy('c.datePublished', 'DESC')
->setParameter('slug',$term)
->setParameter('status',1)
->setFirstResult(0)
->setMaxResults($limit);
return $qb->getQuery()->getResult();
}
public function buildTermWidget(WidgetInterface $widget)
{
$view = $this->createView($widget);
$view->collection = $this->contentRepository->findContentTypeByTerm($widget->getContentType(), $widget->getTerm(), $widget->getRecordLimit());
return $view;
}
I do not know if the different versions of mysql server on both the production and development is causing this problem.
Development Machine: Linux Ubuntu,Xampp - Mysql 5.6.14 - Source distribution
Production Machine: Linux CentOS - Mysql 5.5.36-cll-lve - MySQL Community Server (GPL)
I do not have access to the production server.
[Edit]The error message below
Fatal error: Uncaught exception 'Doctrine\ORM\Query\QueryException' with message 'SELECT c, m, u, t FROM Invetico\ContentBundle\Entity\Serminar c LEFT JOIN c.menu m LEFT JOIN c.user u LEFT JOIN c.term t WHERE t.slug = :slug AND c.status = :status ORDER BY c.datePublished DESC' in /home/zibaconsult/vendor/doctrine/orm/lib/Doctrine/ORM/Query/QueryException.php:41
Stack trace:
#0 /home/zibaconsult/vendor/doctrine/orm/lib/Doctrine/ORM/Query/Parser.php(483): Doctrine\ORM\Query\QueryException::dqlError('SELECT c, m, u,...')
#1 /home/zibaconsult/vendor/doctrine/orm/lib/Doctrine/ORM/Query/Parser.php(1042): Doctrine\ORM\Query\Parser->semanticalError('Class Invetico\...')
#2 /home/zibaconsult/vendor/doctrine/orm/lib/Doctrine/ORM/Query/Parser.php(1688): Doctrine\ORM\Query\Parser->JoinAssociationPathExpression()
#3 /home/zibaconsult/vendor/doctrine/orm/lib/Doctrine/ORM/Query/Parser.php(1628): Doctrine\ORM\Query\Parser->JoinAssociationDeclaration()
#4 /home/zibaconsult/vendor/doctrine/orm/lib/Doctrine/ORM/Query/Parser.php(1558): Doctr in /home/zibaconsult/vendor/doctrine/orm/lib/Doctrine/ORM/Query/QueryException.php on line 63