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;
    }
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;
    }
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 ; }
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
ask this entity for all parents from the model and up the chain lazy load and cache