vendor/pimcore/pimcore/models/Staticroute/Listing/Dao.php line 44

Open in your IDE?
  1. <?php
  2. /**
  3.  * Pimcore
  4.  *
  5.  * This source file is available under two different licenses:
  6.  * - GNU General Public License version 3 (GPLv3)
  7.  * - Pimcore Enterprise License (PEL)
  8.  * Full copyright and license information is available in
  9.  * LICENSE.md which is distributed with this source code.
  10.  *
  11.  * @category   Pimcore
  12.  * @package    Staticroute
  13.  *
  14.  * @copyright  Copyright (c) Pimcore GmbH (http://www.pimcore.org)
  15.  * @license    http://www.pimcore.org/license     GPLv3 and PEL
  16.  */
  17. namespace Pimcore\Model\Staticroute\Listing;
  18. use Pimcore\Model;
  19. /**
  20.  * @property \Pimcore\Model\Staticroute\Listing $model
  21.  */
  22. class Dao extends Model\Dao\PhpArrayTable
  23. {
  24.     public function configure()
  25.     {
  26.         parent::configure();
  27.         $this->setFile('staticroutes');
  28.     }
  29.     /**
  30.      * Loads a list of static routes for the specicifies parameters, returns an array of Staticroute elements
  31.      *
  32.      * @return array
  33.      */
  34.     public function load()
  35.     {
  36.         $routesData $this->db->fetchAll($this->model->getFilter(), $this->model->getOrder());
  37.         $routes = [];
  38.         foreach ($routesData as $routeData) {
  39.             $routes[] = Model\Staticroute::getById($routeData['id']);
  40.         }
  41.         $this->model->setRoutes($routes);
  42.         return $routes;
  43.     }
  44.     /**
  45.      * @return int
  46.      */
  47.     public function getTotalCount()
  48.     {
  49.         $data $this->db->fetchAll($this->model->getFilter(), $this->model->getOrder());
  50.         $amount count($data);
  51.         return $amount;
  52.     }
  53. }