We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 here.

Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

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 ?

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.