ask this entity for all parents from the model and up the chain
lazy load and cache

@param bool $withNamespace
should the parent names be formatted as a full namespace?

@return array|boolean list of parent models or false
350378
public function getParentModels($withNamespace = false)
    {
        $modelNameSpace = null;

        // first load parentModels
        if (!isset($parentModels)) {
            /** @var BaseModel $path */
            $config = $this->getDI()->get('config');
            $modelNameSpace = $config['namespaces']['models'];
            $path = $modelNameSpace . $this->getModelName();
            $parents = array();

            $currentParent = $path::$parentModel;

            while ($currentParent) :
                $parents[] = $currentParent;
                $path = $modelNameSpace . $currentParent;
                $currentParent = $path::$parentModel;
            endwhile;
            $this->parentModels = $parents;
        }

        if (count($this->parentModels) == 0) {
            return false;
        }

        // reset name space if it was not asked for
        if (!$withNamespace) {
            $modelNameSpace = null;
        }

        $parents = [];
        foreach ($this->parentModels as $parent) {
            $parents[] = $modelNameSpace . $parent;
        }

        return $parents;
    }
417567
public function getPreloadedNodes(bool $andClear = true, string $namespace = NcrPreloader::DEFAULT_NAMESPACE): array
    {
        $nodes = $this->ncrPreloader->getNodes(null, $namespace);
        if ($andClear) {
            $this->ncrPreloader->clear($namespace);
        }

        return $nodes;
    }
161041
public function getListParent()
    {
        $parent = session()->get($this->getSessionKey(static::TYPE_PARENT));

        if (null === $parent) {
            return null;
        }

        if (static::PARENT_DISABLE === $parent) {
            return false;
        }

        list($relation, $key) = explode(':', $parent, 2);

        return compact('relation', 'key');
    }
747879
public function model($name = '', $namespace = null)
    {
        if (null === $name) {
            $namespace = $this->namespace;
        }

        $namespace = $this->resolveNamespace($namespace);
        $model = $this->model = $this->createModelInstance($namespace, $name);

        return $model;
    }
1128339
public function parents()
    {
        if (!$this->nodes) {
            throw new \InvalidArgumentException('The current node list is empty.');
        }

        $node = $this->getNode(0);
        $nodes = array();

        while ($node = $node->parentNode) {
            if (XML_ELEMENT_NODE === $node->nodeType) {
                $nodes[] = $node;
            }
        }

        return $this->createSubCrawler($nodes);
    }
691818
public function GetClassChilds($class_name, $namespace="")
    {   
        $childs = array();
        
        if(!$namespace)
        {
            $components = $this->GetComponents($class_name);
            
            if($components->HasNamespace())
            {
                $namespace = $components->namespace;
                $class_name = $components->type;
            }
            else
            {
                $namespace = "\\";
            }
        }
        
        $parent_class = "";
        
        if($namespace != "\\")
            $parent_class .= $namespace . "\\" . $class_name;
        else
            $parent_class .= $class_name;
        
        foreach($this->headers as $header_object)
        {
            foreach($header_object->namespaces as $namespace_object)
            {
                foreach($namespace_object->classes as $class_object)
                {
                    if(in_array($parent_class, $class_object->parents))
                    {
                        $childs[$class_object->name] = $class_object;
                        
                        $childs += $this->GetClassChilds(
                            $class_object->name,
                            $class_object->namespace->name
                        );
                    }
                }
            }
        }
        
        return $childs;
    }
1218499
public function getAll($namespace = 'default')
    {
        if ($this->state !== static::STATE_ACTIVE && $this->state !== static::STATE_EXPIRED) {
            if ($this->debug) {
                throw new \RuntimeException('Session is not active.');
            }

            return [];
        }

        return $this->getBag($namespace)->all();
    }
923325
private function getMetadataForNamespace($namespace)
    {
        $metadata = [];
        foreach ($this->getAllMetadata() as $m) {
            if (strpos($m->name, $namespace) !== 0) {
                continue;
            }

            $metadata[] = $m;
        }

        return new ClassMetadataCollection($metadata);
    }
390743
protected function getNodeDataForParentAndNodeType($parentPath, $nodeTypeFilter, Workspace $workspace, array $dimensions = null, $removedNodes = false, $recursive = false)
    {
        $workspaces = $this->collectWorkspaceAndAllBaseWorkspaces($workspace);

        $queryBuilder = $this->createQueryBuilder($workspaces);
        if ($dimensions !== null) {
            $this->addDimensionJoinConstraintsToQueryBuilder($queryBuilder, $dimensions);
        } else {
            $dimensions = [];
        }
        $this->addParentPathConstraintToQueryBuilder($queryBuilder, $parentPath, $recursive);
        if ($nodeTypeFilter !== null) {
            $this->addNodeTypeFilterConstraintsToQueryBuilder($queryBuilder, $nodeTypeFilter);
        }

        $query = $queryBuilder->getQuery();
        $nodes = $query->getResult();

        $foundNodes = $this->reduceNodeVariantsByWorkspacesAndDimensions($nodes, $workspaces, $dimensions);
        $foundNodes = $this->filterNodeDataByBestMatchInContext($foundNodes, $workspaces[0], $dimensions, $removedNodes);

        if ($removedNodes === true) {
            $foundNodes = $this->onlyRemovedNodes($foundNodes);
        } elseif ($removedNodes === false) {
            $foundNodes = $this->withoutRemovedNodes($foundNodes);
        }

        return $foundNodes;
    }
599900
public function getClassesFromNamespace($namespace = null)
    {
        $namespace = $namespace ?: $this->getAppNamespace();

        $path = $this->convertNamespaceToPath($namespace);

        return $this->finder->findClasses($path);
    }
1082942
protected function getDefaultNamespace($rootNamespace)
    {
        $namespace = Config::get('service-classes.cached_services.namespace');
        $serviceNamespace = Config::get('service-classes.namespace');

        if (! $serviceNamespace) {
            throw InvalidNamespaceException::missingServiceNamespace();
        }

        return $this->defaultNamespace = $namespace ? $rootNamespace.'\\'.Config::get('service-classes.namespace').'\\'.$namespace
                      : $rootNamespace.'\\'.Config::get('service-classes.cached_services.namespace');
    }
795241
public function HasNamespace($namespace, $header="")
    {
        if($header)
        {
            if(isset($this->headers[$header]->namespaces[$namespace]))
            {
                return $this->headers[$header]->namespaces[$namespace];
            }
        }
        else
        {
            foreach($this->headers as $header_object)
            {
                if(isset($header_object->namespaces[$namespace]))
                {
                    return $header_object->namespaces[$namespace];
                }
            }
        }
        
        return null;
    }
258251
public function getParentList(){
        if(!$this->isPropertyAvailable('ParentList')){
            $this->setProperty("ParentList", new SPList($this->getContext(),new ResourcePathEntity($this->getContext(),$this->getResourcePath(), "parentlist")),false);
        }
        return $this->getProperty("ParentList");
    }
163815
public function getNode($id, $withParent = false) {
        $repo = $this->getRepository();
        $pk = $repo->getPrimaryKey();
        $query = $repo->select();

        if ($withParent) {
            $query
                ->where($repo->getAlias() . '.' . $pk, $id)
                ->leftJoin(
                    [$repo->getTable(), 'Parent'],
                    array_keys($repo->getSchema()->getColumns()), // We need the fields or joins fail
                    [$this->getConfig('parentField') => 'Parent.' . $pk]
                );
        } else {
            $query->where($pk, $id);
        }

        return $query->first();
    }
637675
public function toArray(bool $withParentAndChild = true): array
    {
        $array = [
            'name'                  => $this->getName(),
            'shortName'             => $this->getShortName(),
            'configurationRootName' => $this->getConfigurationRootName(),
            'rootNamespace'         => $this->getRootNamespace(),
            'path'                  => $this->getPath(),
            'dataFixtures'          => $this->getDataFixtures()->toArray(),
        ];

        if ($withParentAndChild) {
            if (null !== $this->getParentBundleDescriptor()) {
                $array['parentBundleDescriptor'] = $this->getParentBundleDescriptor()->toArray(false);
            }

            if (null !== $this->getChildBundleDescriptor()) {
                $array['childBundleDescriptor'] = $this->getChildBundleDescriptor()->toArray(false);
            }
        }

        return $array;
    }
689561
public function get_parent_contexts($includeself = false) {
        if (!$contextids = $this->get_parent_context_ids($includeself)) {
            return array();
        }

        // Preload the contexts to reduce DB calls.
        context_helper::preload_contexts_by_id($contextids);

        $result = array();
        foreach ($contextids as $contextid) {
            $parent = context::instance_by_id($contextid, MUST_EXIST);
            $result[$parent->id] = $parent;
        }

        return $result;
    }
172809
private function getNamespaceDirectory($namespace)
    {
        $composerNamespaces = $this->getDefinedNamespaces();

        $namespaceFragments = explode('\\', $namespace);
        $undefinedNamespaceFragments = [];

        while ($namespaceFragments) {
            $possibleNamespace = implode('\\', $namespaceFragments) . '\\';

            if (array_key_exists($possibleNamespace, $composerNamespaces)) {
                $path = app()->basePath() . DIRECTORY_SEPARATOR . $composerNamespaces[$possibleNamespace] . implode('/', array_reverse($undefinedNamespaceFragments));

                return realpath($path);
            }

            $undefinedNamespaceFragments[] = array_pop($namespaceFragments);
        }

        return false;
    }