Inheritance: extends Pimcore\Model\AbstractModel
 protected function determineResourceClass($className)
 {
     if (Tool::classExists($className)) {
         return $className;
     }
     return parent::determineResourceClass($className);
 }
Esempio n. 2
0
 /**
  * @param AbstractListing $list
  */
 protected static function loadToCache(AbstractListing $list)
 {
     $totalCount = $list->getTotalCount();
     $iterations = ceil($totalCount / self::getPerIteration());
     \Logger::info("New list of elements queued for storing into the cache with " . $iterations . " iterations and " . $totalCount . " total items");
     for ($i = 0; $i < $iterations; $i++) {
         \Logger::info("Starting iteration " . $i . " with offset: " . self::getPerIteration() * $i);
         $list->setLimit(self::getPerIteration());
         $list->setOffset(self::getPerIteration() * $i);
         $elements = $list->load();
         foreach ($elements as $element) {
             $cacheKey = Element\Service::getElementType($element) . "_" . $element->getId();
             Cache::storeToCache($element, $cacheKey, [], null, null, true);
         }
         \Pimcore::collectGarbage();
         sleep(self::getTimoutBetweenIteration());
     }
 }
Esempio n. 3
0
 /**
  * @param string $condition
  * @return $this
  */
 public function setCondition($condition, $conditionVariables = null)
 {
     $this->reset();
     return parent::setCondition($condition, $conditionVariables);
     // TODO: Change the autogenerated stub
 }
Esempio n. 4
0
 /**
  * @param $condition
  * @param null $conditionVariables
  * @return $this
  */
 public function setCondition($condition, $conditionVariables = null)
 {
     $this->reset();
     return parent::setCondition($condition, $conditionVariables);
 }
Esempio n. 5
0
 /**
  * @param $groupBy
  * @param bool $qoute
  * @return $this
  */
 public function setGroupBy($groupBy, $qoute = true)
 {
     $this->reset();
     return parent::setGroupBy($groupBy, $qoute);
     // TODO: Change the autogenerated stub
 }
Esempio n. 6
0
 /**
  * Returns the SQL condition value.
  *
  * @return string
  */
 public function getCondition()
 {
     $condition = parent::getCondition();
     if ($condition) {
         if (Document::doHideUnpublished() && !$this->getUnpublished()) {
             $condition = " (" . $condition . ") AND published = 1";
         }
     } elseif (Document::doHideUnpublished() && !$this->getUnpublished()) {
         $condition = "published = 1";
     }
     return $condition;
 }