Re: DB_Nested 1.3 createRootNode problem

From: Date: Mon, 27 Oct 2003 16:19:31 +0000
Subject: Re: DB_Nested 1.3 createRootNode problem
References: 1 2 3  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-23040@lists.php.net to get a copy of this message
Greg Beaver wrote: Hello Greg,
I would suggest breaking createRootNode() into two methods, createFirstRootNode() and addRootNode(). The API would be function createFirstRootNode($values) function addRootNode($values, $id, $_pos = 'AF') <--- also, shouldn't 'AF' be the constant NESE_MOVE_AFTER? You needn't remove createRootNode(), but you should deprecate it in favor of these two new methods in the documentation, and make them a wrapper of createRootNode(). Optional parameters was a bad choice since they really aren't optional for the creation of a new tree, or for adding a root node to a tree.
I will add a createFirstRootNode() method and deprecate createRootNode(). addRootNode() isn't needed as createLeftNode($rootnode)/createRightNode($rootnode) do this. createRootNode() is only needed for the first rootnode. But I agree that this is a little confusing ATM.
I would also strongly encourage you to drop the explicit specification of a mode in _raiseError(). You needn't change any of the calls to _raiseError() immediately, but simply pass in null instead of $mode to PEAR::raiseError(). I don't like seeing packages controlling error handling, that is an application realm.
I know. I am running into BC breaks if I change too much of this for now. But I will have another look at the last versions to see what can be changed. The next major release will change this for sure. Thanks Daniel Khan

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