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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With