Pimcore\Model\Object\ClassDefinition\Data\Classificationstore::recursiveGetActiveGroupsIds PHP Method

recursiveGetActiveGroupsIds() public method

public recursiveGetActiveGroupsIds ( $object, array $activeGroups = [] ) : array
$object \Object_Abstract
$activeGroups array
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;
    }