Announce-RFC Structures::NestedSet
| From: | Daniel Khan | Date: | Sat, 01 Mar 2003 04:43:22 +0000 |
| Subject: | Announce-RFC Structures::NestedSet | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-14049@lists.php.net to get a copy of this message | ||
Hello list,
some time ago I wrote a class which handles nested sets using the database
abstraction
of phplib.
About 2 months ago I came across Structures::Tree and saw that some
interesting features of it's nested
sets part aren't ready yet. I went trough the Tree code trying to find a way
to implement the missing features
with methods of my class. Finally I decided that it would be much easier to
simply port my allready working
class to pear while doing a major code cleanup. I got in touch with Wolfram
Kriesing and he told me that it wouldn't
be a problem to have packages in pear which solve equal problems and that he
wouldn't
shoot me if I announce it to the list ;)
I have ported the class, abstracted it totally from the framework it is used
for in my company and did pretty commenting.
Now the package is basically ready and working - only 2 extended features
are left on my todo list.
So the time has come to ask you if this package would go into pear because
in that case I have to write
a little documentation, some exaples, etc.
Features of NestedSets:
- creating/deleting/changing/moving/copying nodes
- Fetching meta information such as children, parents, sisters, the level
etc.
- Very simple table locking mechanism (Transactions would be nicer...)
For performance reasons each rootnode (level 1) whith it's children is
handled as independent tree.
The level of a node is stored into the database at creation time so there
haven't to be expensive self joins
to query this type of metadata.
Each node has it's position (order) within the level it belongs to stored
inside the database, so moving a node
or subtree inside the same level is very cheap.
TODO:
IMPORTANT:
- Finish callbacks to do extended operations on node manipulations
(e.g. if used inside a cms delete all images belonging to that node)
NICE TO HAVE:
- Optionally integrate PEAR Cache
(it should be possible to pass the cache object to be used for tree queries)
Overall status:
BETA
There has to be done some testing because of the code cleanup and pear
porting.
The phplib-based class is in production use.
Maintenance:
NestedSet is a core class of a framework I use in my company. So bugfixes
and ongoing
development is asured (3 developers working with it).
O.K. that's it
Comments apreciated
--
Daniel [datenPUNK] Khan