vendor/pimcore/pimcore/bundles/EcommerceFrameworkBundle/PricingManager/Rule/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 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\Bundle\EcommerceFrameworkBundle\PricingManager\Rule\Listing;
  15. use Pimcore\Bundle\EcommerceFrameworkBundle\PricingManager\Rule\Listing;
  16. /**
  17.  * @internal
  18.  *
  19.  * @property Listing $model
  20.  */
  21. class Dao extends \Pimcore\Model\Listing\Dao\AbstractDao
  22. {
  23.     /**
  24.      * @var string
  25.      */
  26.     protected $ruleClass '\Pimcore\Bundle\EcommerceFrameworkBundle\PricingManager\Rule';
  27.     /**
  28.      * @return array
  29.      */
  30.     public function load()
  31.     {
  32.         $rules = [];
  33.         // load objects
  34.         $ruleIds $this->db->fetchFirstColumn('SELECT id FROM ' \Pimcore\Bundle\EcommerceFrameworkBundle\PricingManager\Rule\Dao::TABLE_NAME .
  35.                                                  $this->getCondition() . $this->getOrder() . $this->getOffsetLimit());
  36.         foreach ($ruleIds as $id) {
  37.             $rules[] = call_user_func([$this->getRuleClass(), 'getById'], $id);
  38.         }
  39.         $this->model->setRules($rules);
  40.         return $rules;
  41.     }
  42.     public function setRuleClass($cartClass)
  43.     {
  44.         $this->ruleClass $cartClass;
  45.     }
  46.     public function getRuleClass()
  47.     {
  48.         return $this->ruleClass;
  49.     }
  50.     public function getTotalCount()
  51.     {
  52.         try {
  53.             return (int) $this->db->fetchOne('SELECT COUNT(*) FROM `' \Pimcore\Bundle\EcommerceFrameworkBundle\PricingManager\Rule\Dao::TABLE_NAME '`' $this->getCondition());
  54.         } catch (\Exception $e) {
  55.             return 0;
  56.         }
  57.     }
  58. }