8

What are the cakePHP usages/meanings of the model, lft, and rght fields in a acos table? Similarly, what are the usages/meanings of the lft and rght fields in a aros table?

takabanana
  • 617
  • 1
  • 8
  • 9

1 Answers1

9

They are required by the Modified Pre-order Tree Traversal data modelling technique commonly used for modelling hierarchical data. They allow quick single query ways of selecting all nodes in a branch. This means you don't have to use recursion and multiple queries. I.e.

SELECT * FROM tree WHERE left > 4 AND right < 8

Where 4 and 8 might be the left and right values of a parent node, whose children and grand children you want to extract.

neilcrookes
  • 4,203
  • 2
  • 21
  • 27
  • 1
    can be automatically filled or fixed by running console script: cake AclExtras.AclExtras recover aro – mvladk Nov 01 '13 at 12:35