How do I filter deep associations in CakePHP

前端 未结 4 805
谎友^
谎友^ 2021-01-13 01:24

I have the following tables: binders, docs, users, docs_users. Doc belongsTo Binder, Doc hasAndBelongsToMany User.

I want to get binders and their associated docs f

4条回答
  •  隐瞒了意图╮
    2021-01-13 02:16

    On this line, you need to tell Cake which Model's id you are talking about:

    'conditions' => array('id = "17"')
    

    e.g. DocsUser.id

    ...and you don't use recursive with containable. Get rid of it.

提交回复
热议问题