Symfony Exception

DBALException

HTTP 500 Internal Server Error

LIMIT argument offset=-21 is not valid

Exception

Doctrine\DBAL\ DBALException

  1.         if ($offset !== null) {
  2.             $offset = (int) $offset;
  3.             if ($offset 0) {
  4.                 throw new DBALException("LIMIT argument offset=$offset is not valid");
  5.             }
  6.             if ($offset && ! $this->supportsLimitOffset()) {
  7.                 throw new DBALException(sprintf("Platform %s does not support offset values in limit queries."$this->getName()));
  8.             }
  9.         }
AbstractPlatform->modifyLimitQuery('SELECT e0_.date AS date_0, e0_.displayorder AS displayorder_1, e0_.certitude AS certitude_2, e0_.status AS status_3, e0_.id AS id_4, e0_.date_update AS date_update_5, e0_.value_id AS value_id_6, e0_.type_id AS type_id_7, e0_.object_id AS object_id_8, e0_.parent_id AS parent_id_9, e0_.commentaire AS commentaire_10, e0_.user_id AS user_id_11, e0_.user_update_id AS user_update_id_12, e0_.value_id AS value_id_13, e0_.type_id AS type_id_14, e0_.object_id AS object_id_15, e0_.association_id AS association_id_16, e0_.parent_id AS parent_id_17 FROM element e0_ LEFT JOIN object o1_ ON e0_.object_id = o1_.id LEFT JOIN `value` v2_ ON e0_.value_id = v2_.id LEFT JOIN type t3_ ON e0_.type_id = t3_.id LEFT JOIN user u4_ ON e0_.user_id = u4_.id LEFT JOIN object_groupe o5_ ON o1_.id = o5_.object_id LEFT JOIN groupe g6_ ON o5_.groupe_id = g6_.id WHERE t3_.template IN (?) AND g6_.id IN (?) ORDER BY o1_.value ASC', 21, -21) in vendor/doctrine/orm/lib/Doctrine/ORM/Query/SqlWalker.php (line 542)
  1.         if ( ! $AST->orderByClause && ($orderBySql $this->_generateOrderedCollectionOrderByItems())) {
  2.             $sql .= ' ORDER BY ' $orderBySql;
  3.         }
  4.         if ($limit !== null || $offset !== null) {
  5.             $sql $this->platform->modifyLimitQuery($sql$limit$offset);
  6.         }
  7.         if ($lockMode === null || $lockMode === false || $lockMode === LockMode::NONE) {
  8.             return $sql;
  9.         }
SqlWalker->walkSelectStatement(object(SelectStatement)) in vendor/doctrine/orm/lib/Doctrine/ORM/Query/Exec/SingleSelectExecutor.php (line 42)
  1.      * @param \Doctrine\ORM\Query\AST\SelectStatement $AST
  2.      * @param \Doctrine\ORM\Query\SqlWalker           $sqlWalker
  3.      */
  4.     public function __construct(SelectStatement $ASTSqlWalker $sqlWalker)
  5.     {
  6.         $this->_sqlStatements $sqlWalker->walkSelectStatement($AST);
  7.     }
  8.     /**
  9.      * {@inheritDoc}
  10.      */
SingleSelectExecutor->__construct(object(SelectStatement), object(SqlWalker)) in vendor/doctrine/orm/lib/Doctrine/ORM/Query/SqlWalker.php (line 277)
  1.                 return ($primaryClass->isInheritanceTypeJoined())
  2.                     ? new Exec\MultiTableUpdateExecutor($AST$this)
  3.                     : new Exec\SingleTableDeleteUpdateExecutor($AST$this);
  4.             default:
  5.                 return new Exec\SingleSelectExecutor($AST$this);
  6.         }
  7.     }
  8.     /**
  9.      * Generates a unique, short SQL table alias.
SqlWalker->getExecutor(object(SelectStatement)) in vendor/doctrine/orm/lib/Doctrine/ORM/Query/Parser.php (line 390)
  1.         $outputWalkerClass $this->customOutputWalker ?: __NAMESPACE__ '\SqlWalker';
  2.         $outputWalker      = new $outputWalkerClass($this->query$this->parserResult$this->queryComponents);
  3.         // Assign an SQL executor to the parser result
  4.         $this->parserResult->setSqlExecutor($outputWalker->getExecutor($AST));
  5.         return $this->parserResult;
  6.     }
  7.     /**
Parser->parse() in vendor/doctrine/orm/lib/Doctrine/ORM/Query.php (line 281)
  1.         }
  2.         // Cache miss.
  3.         $parser = new Parser($this);
  4.         $this->_parserResult $parser->parse();
  5.         $queryCache->save($hash$this->_parserResult$this->_queryCacheTTL);
  6.         return $this->_parserResult;
  7.     }
Query->_parse() in vendor/doctrine/orm/lib/Doctrine/ORM/Query.php (line 293)
  1.     /**
  2.      * {@inheritdoc}
  3.      */
  4.     protected function _doExecute()
  5.     {
  6.         $executor $this->_parse()->getSqlExecutor();
  7.         if ($this->_queryCacheProfile) {
  8.             $executor->setQueryCacheProfile($this->_queryCacheProfile);
  9.         }
Query->_doExecute() in vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php (line 962)
  1.                 $cache->save($cacheKey$result$queryCacheProfile->getLifetime());
  2.             };
  3.         }
  4.         $stmt $this->_doExecute();
  5.         if (is_numeric($stmt)) {
  6.             $setCacheEntry($stmt);
  7.             return $stmt;
AbstractQuery->executeIgnoreQueryCache(null, 1) in vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php (line 917)
  1.     {
  2.         if ($this->cacheable && $this->isCacheEnabled()) {
  3.             return $this->executeUsingQueryCache($parameters$hydrationMode);
  4.         }
  5.         return $this->executeIgnoreQueryCache($parameters$hydrationMode);
  6.     }
  7.     /**
  8.      * Execute query ignoring second level cache.
  9.      *
AbstractQuery->execute(null, 1) in vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php (line 720)
  1.      *
  2.      * @return array
  3.      */
  4.     public function getResult($hydrationMode self::HYDRATE_OBJECT)
  5.     {
  6.         return $this->execute(null$hydrationMode);
  7.     }
  8.     /**
  9.      * Gets the array of results for the query.
  10.      *
AbstractQuery->getResult() in src/CommonBundle/Repository/ElementRepository.php (line 1236)
  1.         $elements->setFirstResult($start)
  2.             ->setMaxResults($limit)
  3.             ->orderBy('o.value''ASC');
  4.         return $elements->getQuery()->getResult();
  5.     }
  6.     public function getLastPlaces($types$groupesIds = [], $limit 10)
  7.     {
  8.         $elements $this->createQueryBuilder('e')
ElementRepository->getElementsByTemplates(array('image_externe'), null, array(68), -21) in src/FrontBundle/Controller/GalleryController.php (line 125)
  1.                 $groupesIds[] = $groupe->getId();
  2.         }
  3.         $data['totalImages'] = $em->getRepository('CommonBundle:Element')->countElementByTypes($types$objectTypeId$groupesIds);
  4.         $data['files'] = $em->getRepository('CommonBundle:Element')->getElementsByTemplates($types$objectTypeId$groupesIds, ($data['page'] - 1) * 21);
  5.         return $this->render('FrontBundle:Gallery:gallery_images.html.twig'$data);
  6.     }
  7. }
GalleryController->galleryImagesAction(object(Request)) in vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php (line 151)
  1.         $this->dispatcher->dispatch(KernelEvents::CONTROLLER_ARGUMENTS$event);
  2.         $controller $event->getController();
  3.         $arguments $event->getArguments();
  4.         // call controller
  5.         $response = \call_user_func_array($controller$arguments);
  6.         // view
  7.         if (!$response instanceof Response) {
  8.             $event = new GetResponseForControllerResultEvent($this$request$type$response);
  9.             $this->dispatcher->dispatch(KernelEvents::VIEW$event);
HttpKernel->handleRaw(object(Request), 1) in vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php (line 68)
  1.     public function handle(Request $request$type HttpKernelInterface::MASTER_REQUEST$catch true)
  2.     {
  3.         $request->headers->set('X-Php-Ob-Level', (string) ob_get_level());
  4.         try {
  5.             return $this->handleRaw($request$type);
  6.         } catch (\Exception $e) {
  7.             if ($e instanceof RequestExceptionInterface) {
  8.                 $e = new BadRequestHttpException($e->getMessage(), $e);
  9.             }
  10.             if (false === $catch) {
HttpKernel->handle(object(Request), 1, true) in vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php (line 200)
  1.         $this->boot();
  2.         ++$this->requestStackSize;
  3.         $this->resetServices true;
  4.         try {
  5.             return $this->getHttpKernel()->handle($request$type$catch);
  6.         } finally {
  7.             --$this->requestStackSize;
  8.         }
  9.     }
Kernel->handle(object(Request)) in web/MABF.php (line 29)
  1. $kernel = new AppKernel('MABF'true);
  2. if (PHP_VERSION_ID 70000) {
  3.     $kernel->loadClassCache();
  4. }
  5. $request Request::createFromGlobals();
  6. $response $kernel->handle($request);
  7. $response->send();
  8. $kernel->terminate($request$response);

Logs

No log messages

Stack Trace

DBALException

Doctrine\DBAL\DBALException:
LIMIT argument offset=-21 is not valid

  at vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/AbstractPlatform.php:3318
  at Doctrine\DBAL\Platforms\AbstractPlatform->modifyLimitQuery('SELECT e0_.date AS date_0, e0_.displayorder AS displayorder_1, e0_.certitude AS certitude_2, e0_.status AS status_3, e0_.id AS id_4, e0_.date_update AS date_update_5, e0_.value_id AS value_id_6, e0_.type_id AS type_id_7, e0_.object_id AS object_id_8, e0_.parent_id AS parent_id_9, e0_.commentaire AS commentaire_10, e0_.user_id AS user_id_11, e0_.user_update_id AS user_update_id_12, e0_.value_id AS value_id_13, e0_.type_id AS type_id_14, e0_.object_id AS object_id_15, e0_.association_id AS association_id_16, e0_.parent_id AS parent_id_17 FROM element e0_ LEFT JOIN object o1_ ON e0_.object_id = o1_.id LEFT JOIN `value` v2_ ON e0_.value_id = v2_.id LEFT JOIN type t3_ ON e0_.type_id = t3_.id LEFT JOIN user u4_ ON e0_.user_id = u4_.id LEFT JOIN object_groupe o5_ ON o1_.id = o5_.object_id LEFT JOIN groupe g6_ ON o5_.groupe_id = g6_.id WHERE t3_.template IN (?) AND g6_.id IN (?) ORDER BY o1_.value ASC', 21, -21)
     (vendor/doctrine/orm/lib/Doctrine/ORM/Query/SqlWalker.php:542)
  at Doctrine\ORM\Query\SqlWalker->walkSelectStatement(object(SelectStatement))
     (vendor/doctrine/orm/lib/Doctrine/ORM/Query/Exec/SingleSelectExecutor.php:42)
  at Doctrine\ORM\Query\Exec\SingleSelectExecutor->__construct(object(SelectStatement), object(SqlWalker))
     (vendor/doctrine/orm/lib/Doctrine/ORM/Query/SqlWalker.php:277)
  at Doctrine\ORM\Query\SqlWalker->getExecutor(object(SelectStatement))
     (vendor/doctrine/orm/lib/Doctrine/ORM/Query/Parser.php:390)
  at Doctrine\ORM\Query\Parser->parse()
     (vendor/doctrine/orm/lib/Doctrine/ORM/Query.php:281)
  at Doctrine\ORM\Query->_parse()
     (vendor/doctrine/orm/lib/Doctrine/ORM/Query.php:293)
  at Doctrine\ORM\Query->_doExecute()
     (vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php:962)
  at Doctrine\ORM\AbstractQuery->executeIgnoreQueryCache(null, 1)
     (vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php:917)
  at Doctrine\ORM\AbstractQuery->execute(null, 1)
     (vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php:720)
  at Doctrine\ORM\AbstractQuery->getResult()
     (src/CommonBundle/Repository/ElementRepository.php:1236)
  at CommonBundle\Repository\ElementRepository->getElementsByTemplates(array('image_externe'), null, array(68), -21)
     (src/FrontBundle/Controller/GalleryController.php:125)
  at FrontBundle\Controller\GalleryController->galleryImagesAction(object(Request))
     (vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php:151)
  at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), 1)
     (vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php:68)
  at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), 1, true)
     (vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php:200)
  at Symfony\Component\HttpKernel\Kernel->handle(object(Request))
     (web/MABF.php:29)