vendor/pimcore/pimcore/models/DataObject/Classificationstore/CollectionConfig/Listing/Dao.php line 33

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\DataObject\Classificationstore\CollectionConfig\Listing;
  15. use Pimcore\Model;
  16. use Pimcore\Model\DataObject;
  17. /**
  18.  * @internal
  19.  *
  20.  * @property \Pimcore\Model\DataObject\Classificationstore\CollectionConfig\Listing $model
  21.  */
  22. class Dao extends Model\Listing\Dao\AbstractDao
  23. {
  24.     /**
  25.      * Loads a list of Classificationstore collection configs for the specified parameters, returns an array of config elements
  26.      *
  27.      * @return array
  28.      */
  29.     public function load()
  30.     {
  31.         $sql 'SELECT id FROM ' DataObject\Classificationstore\CollectionConfig\Dao::TABLE_NAME_COLLECTIONS $this->getCondition() . $this->getOrder() . $this->getOffsetLimit();
  32.         $configsData $this->db->fetchFirstColumn($sql$this->model->getConditionVariables());
  33.         $configData = [];
  34.         foreach ($configsData as $config) {
  35.             $configData[] = DataObject\Classificationstore\CollectionConfig::getById($config);
  36.         }
  37.         $this->model->setList($configData);
  38.         return $configData;
  39.     }
  40.     /**
  41.      * @return array
  42.      */
  43.     public function getDataArray()
  44.     {
  45.         $configsData $this->db->fetchAllAssociative('SELECT * FROM ' DataObject\Classificationstore\CollectionConfig\Dao::TABLE_NAME_COLLECTIONS $this->getCondition() . $this->getOrder() . $this->getOffsetLimit(), $this->model->getConditionVariables());
  46.         return $configsData;
  47.     }
  48.     /**
  49.      * @return int
  50.      */
  51.     public function getTotalCount()
  52.     {
  53.         try {
  54.             return (int) $this->db->fetchOne('SELECT COUNT(*) FROM ' DataObject\Classificationstore\CollectionConfig\Dao::TABLE_NAME_COLLECTIONS ' '$this->getCondition(), $this->model->getConditionVariables());
  55.         } catch (\Exception $e) {
  56.             return 0;
  57.         }
  58.     }
  59. }