unbindModel call in CakePhp. How does it work?

前端 未结 3 1571
星月不相逢
星月不相逢 2021-01-12 05:55

How does unbindModel happen in cake?

$this->User->unbindModel(array(\'hasAndBelongsToMany\' => array(\'Friend\')));

I wrote this i

3条回答
  •  孤独总比滥情好
    2021-01-12 06:33

    From the manual:

    Removing or adding associations using bind- and unbindModel() only works for the next model operation unless the second parameter has been set to false. If the second parameter has been set to false, the bind remains in place for the remainder of the request.

    In other words, after you paginate() or find() or do anything else with the model, the unbinding will be reversed.

提交回复
热议问题