Jackalope\Node::refresh PHP Method

refresh() protected method

{@inheritDoc} This is also called internally to refresh when the node is accessed in state DIRTY.
See also: Item::checkState
protected refresh ( $keepChanges, $internal = false )
    protected function refresh($keepChanges, $internal = false)
    {
        if (!$internal && $this->isDeleted()) {
            throw new InvalidItemStateException('This item has been removed and can not be refreshed');
        }
        $deleted = false;
        // Get properties and children from backend
        try {
            $json = $this->objectManager->getTransport()->getNode(is_null($this->oldPath) ? $this->path : $this->oldPath);
        } catch (ItemNotFoundException $ex) {
            // The node was deleted in another session
            if (!$this->objectManager->purgeDisappearedNode($this->path, $keepChanges)) {
                throw new LogicException($this->path . " should be purged and not kept");
            }
            $keepChanges = false;
            // delete never keeps changes
            if (!$internal) {
                // this is not an internal update
                $deleted = true;
            }
            // continue with empty data, parseData will notify all cached
            // children and all properties that we are removed
            $json = array();
        }
        $this->parseData($json, true, $keepChanges);
        if ($deleted) {
            $this->setDeleted();
        }
    }