Self-Referential ManyToMany Convention in CakePHP

前端 未结 2 1318
陌清茗
陌清茗 2021-01-07 10:30

I have an existing data model where I can rename things freely to match CakePHP\'s conventions. I have a type of graph node, where a node can have an arbitrary number of chi

相关标签:
2条回答
  • 2021-01-07 11:06

    If a node has child nodes, do those child nodes automatically have the first node as a parent?

    This relationship may be similar to a users to users relationship where the relationship symbolises the common 'friend' notion in social networks. Suggest you have a google around for user/friend data models to see if that helps.

    0 讨论(0)
  • 2021-01-07 11:17

    As neilcrookes noted, there are some articles on this on the web about doing this in CakePHP. Here is one of them, using User HABTM User (friends) as an example.

    In that linked article, you can ignore everything after the User class definition if you aren't going to be paginating on the model.

    0 讨论(0)
提交回复
热议问题