public function paginate($target, int $page = 1, int $limit = null, array $options = []): PaginationInterface
{
$limit = $limit ?? $this->defaultOptions[self::DEFAULT_LIMIT];
if ($limit <= 0 || $page <= 0) {
throw new \LogicException("Invalid item per page number. Limit: $limit and Page: $page, must be positive non-zero integers");
}
$offset = ($page - 1) * $limit;
$options = \array_merge($this->defaultOptions, $options);
public function CustomFilterAction($alias)
{
$em = $this->getDoctrine()->getEntityManager();
$filter = $em->getRepository('TroikaMainBundle:FilterPreset')->findOneBy(['alias' => $alias]);
if ($filter) {
$lots = $this->_model('lot')->getEmptyPage();
if ($filter->getTypeLot() && !$filter->getExclusive()) {
switch ($filter->getTypeLot()->getId()) {
case 1:
$data = [
'lots' => $lots,
$this->dispatcher->dispatch($event, KernelEvents::CONTROLLER_ARGUMENTS);
$controller = $event->getController();
$arguments = $event->getArguments();
// call controller
$response = $controller(...$arguments);
// view
if (!$response instanceof Response) {
$event = new ViewEvent($this, $request, $type, $response);
$this->dispatcher->dispatch($event, KernelEvents::VIEW);
{
$request->headers->set('X-Php-Ob-Level', (string) ob_get_level());
$this->requestStack->push($request);
try {
return $this->handleRaw($request, $type);
} catch (\Exception $e) {
if ($e instanceof RequestExceptionInterface) {
$e = new BadRequestHttpException($e->getMessage(), $e);
}
if (false === $catch) {
// When using the HttpCache, you need to call the method in your front controller instead of relying on the configuration parameter
//Request::enableHttpMethodParameterOverride();
$request = Request::createFromGlobals();
try {
$response = $kernel->handle($request, HttpKernelInterface::MASTER_REQUEST, true); //$dev
} catch (Exception $e) {
if ($dev) {
if (property_exists($e, 'xdebug_message')) {
$message = $e->xdebug_message;
} else {
Level | Channel | Message |
---|---|---|
CRITICAL 18:57:25 | request |
Uncaught PHP Exception LogicException: "Invalid item per page number. Limit: 10 and Page: 0, must be positive non-zero integers" at /home/troikaestate/public_html/vendor/knplabs/knp-components/src/Knp/Component/Pager/Paginator.php line 64
{ "exception": { "xdebug_message": "<tr><th align='left' bgcolor='#f57900' colspan=\"5\"><span style='background-color: #cc0000; color: #fce94f; font-size: x-large;'>( ! )</span> LogicException: Invalid item per page number. Limit: 10 and Page: 0, must be positive non-zero integers in /home/troikaestate/public_html/vendor/knplabs/knp-components/src/Knp/Component/Pager/Paginator.php on line <i>64</i></th></tr>\n<tr><th align='left' bgcolor='#e9b96e' colspan='5'>Call Stack</th></tr>\n<tr><th align='center' bgcolor='#eeeeec'>#</th><th align='left' bgcolor='#eeeeec'>Time</th><th align='left' bgcolor='#eeeeec'>Memory</th><th align='left' bgcolor='#eeeeec'>Function</th><th align='left' bgcolor='#eeeeec'>Location</th></tr>\n<tr><td bgcolor='#eeeeec' align='center'>1</td><td bgcolor='#eeeeec' align='center'>0.0001</td><td bgcolor='#eeeeec' align='right'>360336</td><td bgcolor='#eeeeec'>{main}( )</td><td title='/home/troikaestate/public_html/web/app.php' bgcolor='#eeeeec'>.../app.php<b>:</b>0</td></tr>\n<tr><td bgcolor='#eeeeec' align='center'>2</td><td bgcolor='#eeeeec' align='center'>0.0027</td><td bgcolor='#eeeeec' align='right'>406736</td><td bgcolor='#eeeeec'>Symfony\\Component\\HttpKernel\\Kernel->handle( <span>$request = </span><span>class Symfony\\Component\\HttpFoundation\\Request { public $attributes = class Symfony\\Component\\HttpFoundation\\ParameterBag { protected $parameters = [...] }; public $request = class Symfony\\Component\\HttpFoundation\\ParameterBag { protected $parameters = [...] }; public $query = class Symfony\\Component\\HttpFoundation\\ParameterBag { protected $parameters = [...] }; public $server = class Symfony\\Component\\HttpFoundation\\ServerBag { protected $parameters = [...] }; public $files = class Symfony\\Component\\HttpFoundation\\FileBag { protected $parameters = [...] }; public $cookies = class Symfony\\Component\\HttpFoundation\\ParameterBag { protected $parameters = [...] }; public $headers = class Symfony\\Component\\HttpFoundation\\HeaderBag { protected $headers = [...]; protected $cacheControl = [...] }; protected $content = NULL; protected $languages = NULL; protected $charsets = NULL; protected $encodings = NULL; protected $acceptableContentTypes = NULL; protected $pathInfo = '/map/elit_kvartiry_mendeleevskaya'; protected $requestUri = '/map/elit_kvartiry_mendeleevskaya'; protected $baseUrl = ''; protected $basePath = NULL; protected $method = 'GET'; protected $format = NULL; protected $session = class Closure { virtual $closure = "$this->Symfony\\Component\\HttpKernel\\EventListener\\{closure}" }; protected $locale = NULL; protected $defaultLocale = 'ru'; private $preferredFormat = NULL; private $isHostValid = TRUE; private $isForwardedValid = TRUE }</span>, <span>$type = </span><span>1</span>, <span>$catch = </span><span>TRUE</span> )</td><td title='/home/troikaestate/public_html/web/app.php' bgcolor='#eeeeec'>.../app.php<b>:</b>52</td></tr>\n<tr><td bgcolor='#eeeeec' align='center'>3</td><td bgcolor='#eeeeec' align='center'>0.0751</td><td bgcolor='#eeeeec' align='right'>1100136</td><td bgcolor='#eeeeec'>Symfony\\Component\\HttpKernel\\HttpKernel->handle( <span>$request = </span><span>class Symfony\\Component\\HttpFoundation\\Request { public $attributes = class Symfony\\Component\\HttpFoundation\\ParameterBag { protected $parameters = [...] }; public $request = class Symfony\\Component\\HttpFoundation\\ParameterBag { protected $parameters = [...] }; public $query = class Symfony\\Component\\HttpFoundation\\ParameterBag { protected $parameters = [...] }; public $server = class Symfony\\Component\\HttpFoundation\\ServerBag { protected $parameters = [...] }; public $files = class Symfony\\Component\\HttpFoundation\\FileBag { protected $parameters = [...] }; public $cookies = class Symfony\\Component\\HttpFoundation\\ParameterBag { protected $parameters = [...] }; public $headers = class Symfony\\Component\\HttpFoundation\\HeaderBag { protected $headers = [...]; protected $cacheControl = [...] }; protected $content = NULL; protected $languages = NULL; protected $charsets = NULL; protected $encodings = NULL; protected $acceptableContentTypes = NULL; protected $pathInfo = '/map/elit_kvartiry_mendeleevskaya'; protected $requestUri = '/map/elit_kvartiry_mendeleevskaya'; protected $baseUrl = ''; protected $basePath = NULL; protected $method = 'GET'; protected $format = NULL; protected $session = class Closure { virtual $closure = "$this->Symfony\\Component\\HttpKernel\\EventListener\\{closure}" }; protected $locale = NULL; protected $defaultLocale = 'ru'; private $preferredFormat = NULL; private $isHostValid = TRUE; private $isForwardedValid = TRUE }</span>, <span>$type = </span><span>1</span>, <span>$catch = </span><span>TRUE</span> )</td><td title='/home/troikaestate/public_html/vendor/symfony/http-kernel/Kernel.php' bgcolor='#eeeeec'>.../Kernel.php<b>:</b>201</td></tr>\n<tr><td bgcolor='#eeeeec' align='center'>4</td><td bgcolor='#eeeeec' align='center'>0.0751</td><td bgcolor='#eeeeec' align='right'>1100928</td><td bgcolor='#eeeeec'>Symfony\\Component\\HttpKernel\\HttpKernel->handleRaw( <span>$request = </span><span>class Symfony\\Component\\HttpFoundation\\Request { public $attributes = class Symfony\\Component\\HttpFoundation\\ParameterBag { protected $parameters = [...] }; public $request = class Symfony\\Component\\HttpFoundation\\ParameterBag { protected $parameters = [...] }; public $query = class Symfony\\Component\\HttpFoundation\\ParameterBag { protected $parameters = [...] }; public $server = class Symfony\\Component\\HttpFoundation\\ServerBag { protected $parameters = [...] }; public $files = class Symfony\\Component\\HttpFoundation\\FileBag { protected $parameters = [...] }; public $cookies = class Symfony\\Component\\HttpFoundation\\ParameterBag { protected $parameters = [...] }; public $headers = class Symfony\\Component\\HttpFoundation\\HeaderBag { protected $headers = [...]; protected $cacheControl = [...] }; protected $content = NULL; protected $languages = NULL; protected $charsets = NULL; protected $encodings = NULL; protected $acceptableContentTypes = NULL; protected $pathInfo = '/map/elit_kvartiry_mendeleevskaya'; protected $requestUri = '/map/elit_kvartiry_mendeleevskaya'; protected $baseUrl = ''; protected $basePath = NULL; protected $method = 'GET'; protected $format = NULL; protected $session = class Closure { virtual $closure = "$this->Symfony\\Component\\HttpKernel\\EventListener\\{closure}" }; protected $locale = NULL; protected $defaultLocale = 'ru'; private $preferredFormat = NULL; private $isHostValid = TRUE; private $isForwardedValid = TRUE }</span>, <span>$type = </span><span>1</span> )</td><td title='/home/troikaestate/public_html/vendor/symfony/http-kernel/HttpKernel.php' bgcolor='#eeeeec'>.../HttpKernel.php<b>:</b>81</td></tr>\n<tr><td bgcolor='#eeeeec' align='center'>5</td><td bgcolor='#eeeeec' align='center'>0.1039</td><td bgcolor='#eeeeec' align='right'>1679976</td><td bgcolor='#eeeeec'>Troika\\RealEstateBundle\\Controller\\FilterPresetController->CustomFilterAction( <span>$alias = </span><span>'elit_kvartiry_mendeleevskaya'</span> )</td><td title='/home/troikaestate/public_html/vendor/symfony/http-kernel/HttpKernel.php' bgcolor='#eeeeec'>.../HttpKernel.php<b>:</b>169</td></tr>\n<tr><td bgcolor='#eeeeec' align='center'>6</td><td bgcolor='#eeeeec' align='center'>0.1740</td><td bgcolor='#eeeeec' align='right'>3260176</td><td bgcolor='#eeeeec'>Troika\\RealEstateBundle\\Model\\LotModel->getEmptyPage( )</td><td title='/home/troikaestate/public_html/src/Troika/RealEstateBundle/Controller/FilterPresetController.php' bgcolor='#eeeeec'>.../FilterPresetController.php<b>:</b>22</td></tr>\n<tr><td bgcolor='#eeeeec' align='center'>7</td><td bgcolor='#eeeeec' align='center'>0.1740</td><td bgcolor='#eeeeec' align='right'>3260176</td><td bgcolor='#eeeeec'>Knp\\Component\\Pager\\Paginator->paginate( <span>$target = </span><span>[]</span>, <span>$page = </span><span>0</span>, <span>$limit = </span><span>10</span>, <span>$options = </span>??? )</td><td title='/home/troikaestate/public_html/src/Troika/RealEstateBundle/Model/LotModel.php' bgcolor='#eeeeec'>.../LotModel.php<b>:</b>832</td></tr>\n" } } |
LogicException |
---|
LogicException: Invalid item per page number. Limit: 10 and Page: 0, must be positive non-zero integers at vendor/knplabs/knp-components/src/Knp/Component/Pager/Paginator.php:64 at Knp\Component\Pager\Paginator->paginate() (src/Troika/RealEstateBundle/Model/LotModel.php:832) at Troika\RealEstateBundle\Model\LotModel->getEmptyPage() (src/Troika/RealEstateBundle/Controller/FilterPresetController.php:22) at Troika\RealEstateBundle\Controller\FilterPresetController->CustomFilterAction() (vendor/symfony/http-kernel/HttpKernel.php:169) at Symfony\Component\HttpKernel\HttpKernel->handleRaw() (vendor/symfony/http-kernel/HttpKernel.php:81) at Symfony\Component\HttpKernel\HttpKernel->handle() (vendor/symfony/http-kernel/Kernel.php:201) at Symfony\Component\HttpKernel\Kernel->handle() (web/app.php:52) |