We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Is there a standard ways to work with hierarchical data in table ?

What is the Best practice to work with classical Adjacency List (table with fields "id", "pid") in phalcon ?

May be is possible to use postgresql "WITH RECURSIVE" or exists some methods to do recursivly job for build trees in models ?



39.2k
Accepted
answer
edited Dec '17

Thanks, looks good. But nested sets much complicated then simple adjancency list. It has a lot of advatages but disavantages too. For example it is necessary to have a lot of resurces when inserting or moving element in hierarchy, it is not use db capability like "with recursive" or "ltree" of postgresql and in mysql every element modification will invalidate whole table in query_cache.