Cakephp,使用条件查找检索 HABTM 模型的数据
有 2 种模型:项目和项目与HABTM关系绑定的类别。 我想从可以执行以下操作的项目控制器执行搜索:
FIND all DISTINCT Project.scedule WHERE Category.slug != 'uncategorised'
对语法表示歉意,我不是续集专家。
我设法做的是检索所有不属于的项目到未分类到数组中的类别,但是我不确定如何再次搜索 DISTINCT Project.schedule 值的数组结果(需要填写下拉表单)
There are 2 Models: Project & Category that are bind with HABTM relationship.
I would like to perform a search from projects controller that can do the following:
FIND all DISTINCT Project.scedule WHERE Category.slug != 'uncategorised'
Apologies for the syntax, I'm no sequel expert.
What I have managed to do is to retrieve all projects that do not belong to Category uncategorised into an array however I'm not sure as to how to search again the array result for DISTINCT Project.schedule values (needed to fill out a form drop down)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在回答这个问题之前,我再次建议您阅读CAKEPHP Cookbook中的HABTM 小心点,这样你就可以自己完成这样的工作了。
Before answer this question,again I suggest you to read the HABTM in cookbook of CAKEPHP carefully,then you can finish jobs like this yourself.