Re: DB_NestedSet: Fatal error: createSubNode(): Node Object not found

From: Date: Fri, 11 Mar 2005 14:53:51 +0000
Subject: Re: DB_NestedSet: Fatal error: createSubNode(): Node Object not found
References: 1 2 3 4  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-36654@lists.php.net to get a copy of this message
Daniel, line 864 is the closing curly bracket for this function:
    // }}}
    // {{{ pickNode()
    /**
    * Fetch the data of a node with the given id
    *
    * @param int $id The node id of the node to fetch
    * @param bool $keepAsArray (optional) Keep the result as an array or transform it into
    *                a set of DB_NestedSet_Node objects?
    * @param bool $aliasFields (optional) Should we alias the fields so they are the names
    *                of the parameter keys, or leave them as is?
    * @param string $idfield (optional) Which field has to be compared with $id?
    *                 This is can be used to pick a node by other values (e.g. it's name).
    * @param array $addSQL (optional) Array of additional params to pass to the query.
    * @see _addSQL
    * @access public
    * @return mixed False on error, or an array of nodes
    */
    function pickNode($id, $keepAsArray = false, $aliasFields = true, $idfield = 'id', $addSQL = array()) {
        if ($this->debug) {
            $this->_debugMessage('pickNode($id)');
        }
        if (is_object($id) && $id->id) {
            return $id;
        } elseif (is_array($id) && isset($id['id'])) {
            return $id;
        }
        if (!$id) {
            return false;
        }
        $sql = sprintf("SELECT %s %s FROM %s %s WHERE %s.%s=%s %s %s",
        $this->_getSelectFields($aliasFields), $this->_addSQL($addSQL, 'cols'),
        $this->node_table, $this->_addSQL($addSQL, 'join'),
        $this->node_table, $this->flparams[$idfield], $this->_quote($id),
        $this->_addSQL($addSQL, 'where', 'AND'),
        $this->_addSQL($addSQL, 'append'));
        if (!$this->_caching) {
            $nodeSet = $this->_processResultSet($sql, $keepAsArray, $aliasFields);
        } else {
            $nodeSet = $this->cache->call('DB_NestedSet->_processResultSet', $sql, $keepAsArray, $aliasFields);
        }
        $nsKey = false;
        if (!$this->_skipCallbacks && isset($this->_hasListeners['nodeLoad'])) {
            // EVENT (nodeLoad)
            foreach (array_keys($nodeSet) as $key) {
                $this->triggerEvent('nodeLoad', $nodeSet[$key]);
                $nsKey = $key;
            }
        } else {
            foreach (array_keys($nodeSet) as $key) {
                $nsKey = $key;
            }
        }
        if (is_array($nodeSet) && $idfield != 'id') {
            $id = $nsKey;
        }
        return isset($nodeSet[$id]) ? $nodeSet[$id] : false;
    }
Will Killian http://fishingworld.com 903.882.8877 903.882.3110 fax On Mar 11, 2005, at 5:24 AM, Daniel Khan wrote:
Will wrote:
[..] Warning: Illegal offset type in /usr/lib/php/DB/NestedSet.php on line 864 [..]
Which version of DB_NestedSet are you using? Please do a # cat /usr/lib/php/DB/NestedSet.php | grep '$Revision' and send the result to me.
The version number is:
* @version $Revision: 1.86 $
Please send me the contents of _LINE 864_ of /usr/lib/php/DB/NestedSet.php +/- 10 lines. Something looks wrong here.... I can't find that line in my version.. greetings -- Daniel Khan Technische Leitung Geschäftsführender Gesellschafter Ventigo Werbung . IT . Marketing GmbH Kornstrasse 10 4060 Leonding T. +43 (0) 732 37 09 60 | F. +43 (0) 732 37 09 60 10 http://www.ventigo.com | office@ventigo.com


« previous php.pear.dev (#36654) next »