Skip to content
Advertisement

Get category tree recursively (Yii)

I have a table with following structure:

categories

  • id
  • name
  • parent_id

I want to get the tree of categories with single function. I’ve written something like this in my model, but it doesn’t work.

JavaScript

Can someone help me with this? Thanks.

Advertisement

Answer

I’ve finally solved the issue. If someone interested, here’s the code:

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement