How to implement a self referencing (parent_id) model in cakephp

后端 未结 6 1063
悲&欢浪女
悲&欢浪女 2021-02-06 06:35

I have a table called categories. The table holds categories and their sub(subsub)categories...

Its an easy table:

  • id
  • parent_id
  • title
6条回答
  •  别跟我提以往
    2021-02-06 06:56

    In Category model: belongsTo Parent and hasMany Children, both have the class 'Category' and foreign key 'parent_id'

提交回复
热议问题