src/BeeTree/Eloquent/AdjacencyList/WholeTreeModelTrait.php
public function get($id, $rootId=NULL, array $columns=[])
    {
        $columns = $this->pickColumns($columns);
        $columnsId = $this->getColumnsCacheId($columns);

        if (isset($this->_hierachyCache[$columnsId][$id])) {
            return $this->_hierachyCache[$columnsId][$id];
        }

        // If we have a root id, fill the cache by fetching the whole tree
        if ($rootId) {
            $this->tree($rootId, $columns);
        }

        // After retrieving the tree, look if it is now in cache
        if (isset($this->_hierachyCache[$columnsId][$id])) {
            return $this->_hierachyCache[$columnsId][$id];
        }

        $result = $this->queryTreeById($id)
                       ->get($this->toSelectColumns($columns));

        $this->fillNodeCache($columnsId, $result);

        if (isset($this->_hierachyCache[$columnsId][$id])) {
            return $this->_hierachyCache[$columnsId][$id];
        }

    }
public function get($id, $rootId=NULL, array $columns=[])
    {
        $columns = $this->pickColumns($columns);
        $columnsId = $this->getColumnsCacheId($columns);

        if (isset($this->_hierachyCache[$columnsId][$id])) {
            return $this->_hierachyCache[$columnsId][$id];
        }

        // If we have a root id, fill the cache by fetching the whole tree
        if ($rootId) {
            $this->tree($rootId, $columns);
        }

        // After retrieving the tree, look if it is now in cache
        if (isset($this->_hierachyCache[$columnsId][$id])) {
            return $this->_hierachyCache[$columnsId][$id];
        }

        $result = $this->queryTreeById($id)
                       ->get($this->toSelectColumns($columns));

        $this->fillNodeCache($columnsId, $result);

        if (isset($this->_hierachyCache[$columnsId][$id])) {
            return $this->_hierachyCache[$columnsId][$id];
        }

    }
public function get ( $ id , $ rootId = NULL , array $ columns = [ ] ) { $ columns = $ this -> pickColumns ( $ columns ) ; $ columnsId = $ this -> getColumnsCacheId ( $ columns ) ; if ( isset ( $ this -> _hierachyCache [ $ columnsId ] [ $ id ] ) ) { return $ this -> _hierachyCache [ $ columnsId ] [ $ id ] ; } // If we have a root id, fill the cache by fetching the whole tree if ( $ rootId ) { $ this -> tree ( $ rootId , $ columns ) ; } // After retrieving the tree, look if it is now in cache if ( isset ( $ this -> _hierachyCache [ $ columnsId ] [ $ id ] ) ) { return $ this -> _hierachyCache [ $ columnsId ] [ $ id ] ; } $ result = $ this -> queryTreeById ( $ id ) -> get ( $ this -> toSelectColumns ( $ columns ) ) ; $ this -> fillNodeCache ( $ columnsId , $ result ) ; if ( isset ( $ this -> _hierachyCache [ $ columnsId ] [ $ id ] ) ) { return $ this -> _hierachyCache [ $ columnsId ] [ $ id ] ; } }
Retrieve a tree by its ID

@param mixed $id The id of this node, which is the same as node->getIdentifier()
@param mixed $rootId The rootId of the tree, optional to speed up the initial query
@return \BeeTree\Contracts\Node
Retrieve a tree by its ID