[英]Phalcon - add OR criteria to find()
希望有人可以帮忙。
我正在使用find()如下
$query = Criteria::fromInput($this->di, 'Models\Templates', $this->request->getPost());
$this->persistent->searchParams = $query->getParams();
$parameters = $this->persistent->searchParams;
$templates= templates::find(
$parameters,
);
这使我根据发布的参数生成了一组模板。
我想要做的就是以某种方式将OR添加到这些参数中。
例如,找到所有符合条件的模板,或者找到“ global”字段设置为Y的模板
我打算运行第二个查询以获取全局模板并连接结果集,但是肯定有某种方法可以将OR添加到条件中?
任何帮助将非常感激!
马丁
$query = Criteria::fromInput($this->di, 'Models\Templates', $this->request->getPost());
//added this below to add the additional or query to the Criteria builder
$query->orWhere("global = 'Y'");
$this->persistent->searchParams = $query->getParams();
parameters = $this->persistent->searchParams;
$templates= templates::find(
$parameters,
);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.