Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: PHP
Posted by: Anton Butkov
Added: Jul 20, 2020 6:48 PM
Views: 105
  1.         $models = Core_Client_Model_Query::create()
  2.              ->setWithCount(true)
  3.              ->setColumns(['model_id','alias','model_name','best_screenshots','country_id',
  4.                  'best_screenshot','sex','stats.is_solo','stats.max_sales_at_day_547','headshot',
  5.                  'stats.avg_sales_at_day_547','stats.total_goods','scenes_tour','scenes'])
  6.              ->filterByFirstLetter($this->firstLetter)
  7.              ->filterBySex($this->sexFilter)
  8.              ->filterByLabelId($this->getStudio() ? $this->getStudio()->label_id : null)
  9.              ->filterByModelName($this->modelName)
  10.              ->filterByNationality($this->nationality)
  11.              ->limit(self::ITEMS_IN_PAGE, ($page - 1) * self::ITEMS_IN_PAGE)
  12.              ->filterByModelId($this->modelId)
  13.              ->setSort($this->sort)
  14.              ->find();
  15.        
  16.         $adapter = new Zend_Paginator_Adapter_Null($models->getTotalCount());
  17.         $paginator = new Zend_Paginator($adapter);
  18.         $paginator->setCurrentPageNumber($this->pageNumber);
  19.         $paginator->setItemCountPerPage(self::ITEMS_IN_PAGE);
  20.         return [$paginator, $models->toArray()];