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

recursiveGetActiveGroupCollectionMapping() public method

public recursiveGetActiveGroupCollectionMapping ( $object, $mergedMapping = [] )
    public function recursiveGetActiveGroupCollectionMapping($object, $mergedMapping = [])
    {
        if (!$object) {
            return;
        }
        $getter = "get" . ucfirst($this->getName());
        /** @var  $classificationStore Object\Classificationstore */
        $classificationStore = $object->{$getter}();
        $mapping = $classificationStore->getGroupCollectionMappings();
        if (is_array($mapping)) {
            foreach ($mapping as $groupId => $collectionId) {
                if (!isset($mergedMapping[$groupId]) && $collectionId) {
                    $mergedMapping[$groupId] = $collectionId;
                }
            }
        }
        $class = $object->getClass();
        $inheritanceAllowed = $class->getAllowInherit();
        if ($inheritanceAllowed) {
            $parent = Object\Service::hasInheritableParentObject($object);
            if ($parent) {
                $mergedMapping = $this->recursiveGetActiveGroupCollectionMapping($parent, $mergedMapping);
            }
        }
        return $mergedMapping;
    }