Pimcore\Model\Object\Listing::setUnpublished PHP Method

setUnpublished() public method

public setUnpublished ( $unpublished ) : boolean
return boolean
    public function setUnpublished($unpublished)
    {
        $this->unpublished = (bool) $unpublished;
        return $this;
    }

Usage Example

示例#1
0
 public static function getUniqueKey($item, $nr = 0)
 {
     $list = new Listing();
     $list->setUnpublished(true);
     $key = \Pimcore\File::getValidFilename($item->getKey());
     if (!$key) {
         throw new \Exception("No item key set.");
     }
     if ($nr) {
         $key = $key . '_' . $nr;
     }
     $parent = $item->getParent();
     if (!$parent) {
         throw new \Exception("You have to set a parent Object to determine a unique Key");
     }
     if (!$item->getId()) {
         $list->setCondition('o_parentId = ? AND `o_key` = ? ', array($parent->getId(), $key));
     } else {
         $list->setCondition('o_parentId = ? AND `o_key` = ? AND o_id != ? ', array($parent->getId(), $key, $item->getId()));
     }
     $check = $list->loadIdList();
     if (!empty($check)) {
         $nr++;
         $key = self::getUniqueKey($item, $nr);
     }
     return $key;
 }
All Usage Examples Of Pimcore\Model\Object\Listing::setUnpublished