vendor/pimcore/pimcore/models/Site/Listing/Dao.php line 38

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 Commercial License (PCL)
  8.  * Full copyright and license information is available in
  9.  * LICENSE.md which is distributed with this source code.
  10.  *
  11.  *  @copyright  Copyright (c) Pimcore GmbH (http://www.pimcore.org)
  12.  *  @license    http://www.pimcore.org/license     GPLv3 and PCL
  13.  */
  14. namespace Pimcore\Model\Site\Listing;
  15. use Pimcore\Model;
  16. /**
  17.  * @internal
  18.  *
  19.  * @property \Pimcore\Model\Site\Listing $model
  20.  */
  21. class Dao extends Model\Listing\Dao\AbstractDao
  22. {
  23.     /**
  24.      * Loads a list of thumanils for the specicifies parameters, returns an array of Thumbnail elements
  25.      *
  26.      * @return array
  27.      */
  28.     public function load()
  29.     {
  30.         $sites = [];
  31.         $sitesData $this->db->fetchFirstColumn('SELECT id FROM sites' $this->getCondition() . $this->getOrder() . $this->getOffsetLimit(), $this->model->getConditionVariables());
  32.         foreach ($sitesData as $siteData) {
  33.             $sites[] = Model\Site::getById($siteData);
  34.         }
  35.         $this->model->setSites($sites);
  36.         return $sites;
  37.     }
  38.     /**
  39.      * @return int
  40.      */
  41.     public function getTotalCount()
  42.     {
  43.         try {
  44.             return (int) $this->db->fetchOne('SELECT COUNT(*) FROM sites ' $this->getCondition(), $this->model->getConditionVariables());
  45.         } catch (\Exception $e) {
  46.             return 0;
  47.         }
  48.     }
  49. }