src/NodeBag.php
public function getOrFind($id, $published = true)
    {
        $node = $this->get($id);

        if (is_null($node))
        {
            $node = $published ?
                PublishedNode::find($id) :
                Node::find($id);

            $this->put($id, $node);
        }

        return $node;
    }
public function getOrFind($id, $published = true)
    {
        $node = $this->get($id);

        if (is_null($node))
        {
            $node = $published ?
                PublishedNode::find($id) :
                Node::find($id);

            $this->put($id, $node);
        }

        return $node;
    }
public function getOrFind ( $ id , $ published = true ) { $ node = $ this -> get ( $ id ) ; if ( is_null ( $ node ) ) { $ node = $ published ? PublishedNode :: find ( $ id ) : Node :: find ( $ id ) ; $ this -> put ( $ id , $ node ) ; } return $ node ; }
Gets or finds the node and sets by id

@param int $id
@param bool $published
@return Node
Gets or finds the node and sets by id