Releases for sf 1.4
| Version |
License |
API |
Released |
|
0.9.1beta
|
LGPL |
0.9.1beta
|
23/07/2007 |
|
0.9.0beta
|
LGPL |
0.9.0beta
|
24/05/2007 |
Releases for sf 1.3
| Version |
License |
API |
Released |
|
0.9.1beta
|
LGPL |
0.9.1beta
|
23/07/2007 |
|
0.9.0beta
|
LGPL |
0.9.0beta
|
24/05/2007 |
Releases for sf 1.2
| Version |
License |
API |
Released |
|
0.9.2beta
|
LGPL |
0.9.2beta
|
28/10/2009 |
|
0.9.1beta
|
LGPL |
0.9.1beta
|
23/07/2007 |
|
0.9.0beta
|
LGPL |
0.9.0beta
|
24/05/2007 |
Releases for sf 1.1
| Version |
License |
API |
Released |
|
0.9.1beta
|
LGPL |
0.9.1beta
|
23/07/2007 |
|
0.9.0beta
|
LGPL |
0.9.0beta
|
24/05/2007 |
Releases for sf 1.0
| Version |
License |
API |
Released |
|
0.9.1beta
|
LGPL |
0.9.1beta
|
23/07/2007 |
|
0.9.0beta
|
LGPL |
0.9.0beta
|
24/05/2007 |
|
0.8.2beta
|
MIT license |
0.8.2beta
|
18/04/2007 |
|
0.8.1beta
|
MIT license |
0.8.1beta
|
22/03/2007 |
|
0.8.0beta
|
MIT license |
0.8.0beta
|
19/02/2007 |
|
0.7.0beta
|
MIT license |
0.7.0beta
|
19/02/2007 |
|
0.6.2beta
|
MIT license |
0.6.2beta
|
19/02/2007 |
|
0.6.1beta
|
MIT license |
0.6.1beta
|
15/02/2007 |
|
0.6.0beta
|
MIT license |
0.6.0beta
|
15/02/2007 |
|
0.5.1beta
|
MIT license |
0.5.1beta
|
14/02/2007 |
|
0.5.0beta
|
MIT license |
0.5.0beta
|
14/02/2007 |
Changelog for release 0.6.0 - 15/02/2007
Implemented missing node retrieval methods :
- retrieveFirstChild
- retrieveLastChild
- retrieveParent
- getPath
Updated docs and unit tests accordingly
Other releases
Release 0.9.2 - 28/10/2009
- feature: Added a backward compatible Criteria parameter in
getChildren(), getDescendants(), retrieveSiblings() and getPath() (fzaninotto)
- feature: Added a backward compatible
$peer_method in deleteDescendants() method (works the same way
as ->getChildren() and ->getDescendants() $peer_method parameter)
- feature: Allow user to change behaviour name in app.yml (Frederic Coelho)
- converted to symfony 1.2 only
Release 0.9.1 - 23/07/2007
Bugfixes
- fixed
getLevel() cache (gordon franke)
- fixed scope handling : scope can be any type of data (Jorn.Wagner)
retrieveFirstChild() and retrieveLastChild() missing references to scope node (Olivier.Mansour)
- fixed postgresql compatibility (Maciej.Filipiak and Krasimir.Angelov)
- added a note about supported RDBMS (tristan)
- made roadmap clearer (tristan)
- removed useless Propel::getConnection (Eric.Fredj)
- fixed scope handling in
deleteDescendants() (Piers.Warmers)
- fixed new
getDescendants() implementation node level caching (tristan)
Enhancements
- added new
isDescendantOf() method (Piers.Warmers)
- implemented faster getPath() method (francois)
- implemented faster
getDescendants() (Jon.Collins)
Release 0.9.0 - 24/05/2007
- Licence change : MIT -> LGPL
- Please welcome a new maintainer : Gordan Franke :)
- tree "dumper" utility method :
sfPropelActAsNestedSetBehaviorUtils::dumpTree()
- add optional select method for getPath|getParent|retrieveParent (gordon)
Release 0.8.2 - 18/04/2007
- added
getParent() method (olivier mansour)
- added
getLevel() unit tests
- implemented caching of level in collection retrieval methods :
getDescendants(), getChildren(), retrieveSiblings()
- defined plugin roadmap
Release 0.8.1 - 22/03/2007
- fixed #1480 : non-abstracted column name (paul markovitch)
- fixed bug in
getStubFromPeer()
makeRoot() should accept non new objects (peter van garderen)
getDescendants() should not try to get descendants if node is a leaf (peter van garderen)
- updated unit tests
- enabled syntax highlighting in README
Release 0.8.0 - 19/02/2007
Implemented more methods (+ unit tests) :
insertAsParentOf
retrieveSiblings
isEqualTo
isChildOf
Release 0.7.0 - 19/02/2007
Implemented missing methods (+ unit tests) :
moveToPrevSiblingOf
moveToNextSiblingOf
deleteChildren
deleteDescendants
Release 0.6.2 - 19/02/2007
Fixed a bug due to wrong usage of rtrim. (Thanks to Krešo Kunjas)
Release 0.6.1 - 15/02/2007
Fixed minor bug in getPath()
Release 0.6.0 - 15/02/2007
Implemented missing node retrieval methods :
- retrieveFirstChild
- retrieveLastChild
- retrieveParent
- getPath
Updated docs and unit tests accordingly
Release 0.5.1 - 14/02/2007
Pear package missed plugin's config.php file
Release 0.5.0 - 14/02/2007
Initial public release. The behavior is stable and fully unit-tested, but the API is not yet complete. Missing methods :
- retrieveFirstChild
- retrieveLastChild
- moveToPrevSiblingOf
- moveToNextSiblingOf
- deleteChildren
- deleteTree
- getPath
sfPropelActAsNestedSetBehaviorPlugin plugin
The sfPropelActAsNestedSetBehaviorPlugin is a symfony plugin that provides nested set capabilities to Propel objects.
Nested sets (aka modified preorder tree traversal) is a very efficient way (in terms of performances) to browse and edit a tree like structure in an RDBMS.
You can read a good introduction to nested sets on MySQL developers' zone.
Features
- Fully unit tested
- Possibility to store multiple trees in the same table
- Atomic operations
Installation
Install the plugin
symfony plugin-install http://plugins.symfony-project.com/sfPropelActAsNestedSetBehaviorPlugin
Enable Propel behavior support in propel.ini:
propel.builder.AddBehaviors = true
If you have to enable the behavior support, rebuild your model:
symfony propel-build-model
Enable the behavior for one of your Propel model:
// lib/model/ForumPost.php
class ForumPost
{
}
$columns_map = array('left' => ForumPostPeer::TREE_LEFT,
'right' => ForumPostPeer::TREE_RIGHT,
'parent' => ForumPostPeer::TREE_PARENT,
'scope' => ForumPostPeer::TOPIC_ID);
sfPropelBehavior::add('ForumPost', array('actasnestedset' => array('columns' => $columns_map)));
The column map is used by the behavior to know which columns hold information it needs :
- left : Model column holding nested set left value for a row
- right : Model column holding nested set right value for a row
- parent : Model column holding row's parent id (this is necessary because we use adjacency list tree traversal for some methods)
- scope : Model column holding row's scope id. The scope is used to differenciate trees stored in the same table
Usage
Simple tree creation :
$root = new ForumPost();
$root->makeRoot();
$root->save();
$p1 = new ForumPost();
$p1->insertAsFirstChildOf($root);
$p1->save();
$p2 = new ForumPost();
$p2->insertAsFirstChildOf($p1);
$p2->save();
/*
* Resulting tree :
*
* ROOT
* |- P1
* |- P2
*/
Multiple trees in a single table :
$root1 = new ForumPost();
$root1->makeRoot();
$root1->setTopicId(1);
$root1->save();
$root2 = new ForumPost();
$root2->makeRoot();
$root2->setTopicId(2);
$root2->save();
$p1 = new ForumPost();
$p1->insertAsFirstChildOf($root1);
$p1->save();
$p2 = new ForumPost();
$p2->insertAsFirstChildOf($root2);
$p2->save();
/*
* Resulting trees :
*
* ROOT1
* |- P1
*
* ROOT2
* |- P2
*/
Public API
Enabling the behaviors adds the following method to the Propel objects :
Insertion methods
void insertAsFirstChildOf(BaseObject $dest_node) : Inserts node as first child of given node.
void insertAsLastChildOf(BaseObject $dest_node) : Inserts node as last child of given node.
void insertAsNextSiblingOf(BaseObject $dest_node) : Inserts node as next sibling of given node.
void insertAsPrevSiblingOf(BaseObject $dest_node) : Inserts node as previous sibling of given node.
Informational methods
bool hasChildren() : Returns true if given node as one or several children.
bool isRoot() : Returns true if given node is a root node.
bool hasParent() : Returns true if given node has a parent node.
bool hasNextSibling() : Returns true if given node has a next sibling.
bool hasPrevSibling() : Returns true if given node has a previous sibling.
bool isLeaf() : Returns true if given node does not have children.
integer getNumberOfChildren() : Returns given node number of direct children.
integer getNumberOfDescendants() : Returns given node number of descendants (n level).
integer getLevel() : Returns given node level.
Node retrieval methods
array getChildren($peer_method = 'doSelect') : Returns given node direct children.
array getDescendants($peer_method = 'doSelect') : Returns given node descendants (n level).
BaseObject retrieveNextSibling() : Returns given node next sibling.
BaseObject retrievePrevSibling() : Returns given node previous sibling.
BaseObject retrieveFirstChild() : Returns given node first child.
BaseObject retrieveLastChild() : Returns given node last child.
BaseObject retrieveParent() : Returns given node parent.
array getPath() : Returns path to a specific node as an array, useful to create breadcrumbs.
Tree modification methods
void moveToFirstChildOf(BaseObject $dest_node) : Moves node to first child of given node.
void moveToLastChildOf(BaseObject $dest_node) : Moves node to last child of given node.
void moveToNextSiblingOf() : NOT IMPLEMENTED YET
void moveToPrevSiblingOf() : NOT IMPLEMENTED YET
void deleteChildren() : NOT IMPLEMENTED YET
void deleteTree() : NOT IMPLEMENTED YET
Helper methods
void makeRoot() : Sets node properties to make it a root node.
BaseObject reload() : Returns an up to date version of node