绑定模型和包含cakephp有什么区别?

时间:2011-05-17 06:00:17

标签: cakephp cakephp-1.3

绑定模型和包含cakephp有什么区别?任何人都有想法请与我分享..我是cakephp的新手

1 个答案:

答案 0 :(得分:8)

注意:此答案与CakePHP的1.3版本有关,不再受支持。

CakePHP最强大的功能之一是能够链接模型提供的关系映射。在CakePHP中,模型之间的链接通过关联来处理。 如果在模型中设置这些关联,那么当您检索数据时,Cake也会自动检索关联数据。

可包含的行为允许您过滤和限制模型查找操作(假设您已设置模型关联)

https://book.cakephp.org/1.3/en/The-Manual/Core-Behaviors/Containable.html

bind和unbind对于动态更改模型关联非常有用:

https://book.cakephp.org/1.3/en/The-Manual/Developing-with-CakePHP/Models.html#creating-and-destroying-associations-on-the-fly