I am learning cakePHP 3 and trying to store hierarchical data in a table. I have added parent_id, lft and rght columns. Added $this->addBehavior(‘Tree’) in initialize method for this table. Calling recover method.
I have checked it, when I manually added lft and rght - everything is Ok.
Does anybody know why recover may fail? I could add all lfts and rghts manually, but it is a bad decision, and my table has too many rows:)
Yes, that is what I meant; one root, one left, one right.
So if foreach ($children as $child) returns nothing, the array must be empty. What happens if you remove “->toArray()” then use debug() to put the result of “$children” on the screen?