Pimcore\Model\Object\Service::hasInheritableParentObject PHP Method

hasInheritableParentObject() public static method

public static hasInheritableParentObject ( Concrete $object ) : AbstractObject | null
$object Concrete
return AbstractObject | null
    public static function hasInheritableParentObject(Concrete $object)
    {
        if ($object->getClass()->getAllowInherit()) {
            return $object->getNextParentForInheritance();
        }
        return null;
    }

Usage Example

Example #1
0
 /**
  * @param $object \Object_Abstract
  * @param array $activeGroups
  * @return array
  */
 public function recursiveGetActiveGroupsIds($object, $activeGroups = [])
 {
     if (!$object) {
         return;
     }
     $getter = "get" . ucfirst($this->getName());
     /** @var  $classificationStore Object\Classificationstore */
     $classificationStore = $object->{$getter}();
     $activeGroupIds = $classificationStore->getActiveGroups();
     if ($activeGroupIds) {
         foreach ($activeGroupIds as $groupId => $enabled) {
             if ($enabled) {
                 $activeGroups[$groupId] = $enabled;
             }
         }
     }
     $class = $object->getClass();
     $inheritanceAllowed = $class->getAllowInherit();
     if ($inheritanceAllowed) {
         $parent = Object\Service::hasInheritableParentObject($object);
         if ($parent) {
             $activeGroups = $this->recursiveGetActiveGroupsIds($parent, $activeGroups);
         }
     }
     return $activeGroups;
 }
All Usage Examples Of Pimcore\Model\Object\Service::hasInheritableParentObject