![]() In order to build the tree, you need to retrieve the table rows and recursively build the tree in your client side code (PHP for example). Here is the above category tree in MySQL table: The adjacency list model is the simplest and straightforward way (but not very efficient) to represent hierarchical data. Category tree of the bicycle shop (not so different from The adjacency list model This is the example of data that we will use in this tutorial. ![]() In the second part we will demonstrate how to use stofDoctrineExtensionsBundle (which among other things support hierarchical data) with Symfony 4 and Doctrine. In the first part we will learn about theory and how storing the hierarchical data in the database really works without using 3rd party libraries. In this tutorial you will learn how to store hierarchical data in efficient way. In fact, relational databases are not designed for storing hierarchical data. If you ever had to store hierarchical data (for example, tree of categories) in the relational database (for example MySQL), very soon, you realized it is not easy and efficient.
0 Comments
Leave a Reply. |