Pimcore\Cache\Tool\Warming::objects PHP Method

objects() public static method

public static objects ( array $types = null, $classes = null ) : void
$types array
return void
    public static function objects($types = null, $classes = null)
    {
        if (empty($types)) {
            $types = ["object", "folder", "variant"];
        }
        $classesCondition = "";
        if (!empty($classes)) {
            $classesCondition .= " AND o_className IN ('" . implode("','", $classes) . "')";
        }
        $list = new Object\Listing();
        $list->setCondition("o_type IN ('" . implode("','", $types) . "')" . $classesCondition);
        self::loadToCache($list);
    }

Usage Example

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     if ($input->getOption("maintenance-mode")) {
         // set the timeout between each iteration to 0 if maintenance mode is on, because
         // we don't have to care about the load on the server
         Warming::setTimoutBetweenIteration(0);
     }
     try {
         $types = $this->getArrayOption('types', 'validTypes', 'type', true);
         $documentTypes = $this->getArrayOption('documentTypes', 'validDocumentTypes', 'document type');
         $assetTypes = $this->getArrayOption('assetTypes', 'validAssetTypes', 'asset type');
         $objectTypes = $this->getArrayOption('objectTypes', 'validObjectTypes', 'object type');
     } catch (\InvalidArgumentException $e) {
         $this->writeError($e->getMessage());
         return 1;
     }
     if (in_array('document', $types)) {
         $this->writeWarmingMessage('document', $documentTypes);
         Warming::documents($documentTypes);
     }
     if (in_array('asset', $types)) {
         $this->writeWarmingMessage('asset', $assetTypes);
         Warming::assets($assetTypes);
     }
     if (in_array('object', $types)) {
         $this->writeWarmingMessage('object', $objectTypes);
         Warming::objects($objectTypes);
     }
 }
All Usage Examples Of Pimcore\Cache\Tool\Warming::objects