簡體   English   中英

Phalcon-將OR條件添加到find()

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM