Difference between revisions of "Gallery3:Developer Handbook:MPTT" - Gallery Codex
Personal tools

Difference between revisions of "Gallery3:Developer Handbook:MPTT"

From Gallery Codex

(Created page with "=Modified Preorder Tree Traversal (MPTT)= For storing hierarchical data in the database, Gallery 3 uses the ORM_MPTT subclass to ORM which implements Modified Preorder Tree Trav...")
 
 
Line 3: Line 3:
 
For storing hierarchical data in the database, Gallery 3 uses the ORM_MPTT subclass to ORM which implements Modified Preorder Tree Traversal.  This is a technique for keeping track of parent/child relationships for a tree of data which allows for extremely efficient read access.  [http://articles.sitepoint.com/article/hierarchical-data-database There’s a great description of the concept and how it works on Sitepoint.com] that you should read if you plan on working with MPTT.  The ORM_MPTT class does the bulk of the work for you.  Using it is very simple, simply add ''left_ptr'', ''right_ptr'', ''parent_id'', and ''level'' integer columns to your database table and then have your model extend the ORM_MPTT class instead of ORM.
 
For storing hierarchical data in the database, Gallery 3 uses the ORM_MPTT subclass to ORM which implements Modified Preorder Tree Traversal.  This is a technique for keeping track of parent/child relationships for a tree of data which allows for extremely efficient read access.  [http://articles.sitepoint.com/article/hierarchical-data-database There’s a great description of the concept and how it works on Sitepoint.com] that you should read if you plan on working with MPTT.  The ORM_MPTT class does the bulk of the work for you.  Using it is very simple, simply add ''left_ptr'', ''right_ptr'', ''parent_id'', and ''level'' integer columns to your database table and then have your model extend the ORM_MPTT class instead of ORM.
  
[[Category:Gallery 3:Developer Handbook| MPTT]]
+
[[Category:Gallery 3:Developer Handbook|MPTT]]

Latest revision as of 13:24, 13 June 2011

Modified Preorder Tree Traversal (MPTT)

For storing hierarchical data in the database, Gallery 3 uses the ORM_MPTT subclass to ORM which implements Modified Preorder Tree Traversal. This is a technique for keeping track of parent/child relationships for a tree of data which allows for extremely efficient read access. There’s a great description of the concept and how it works on Sitepoint.com that you should read if you plan on working with MPTT. The ORM_MPTT class does the bulk of the work for you. Using it is very simple, simply add left_ptr, right_ptr, parent_id, and level integer columns to your database table and then have your model extend the ORM_MPTT class instead of ORM.

advertisements