本文整理汇总了PHP中QueryObject::addOrCondition方法的典型用法代码示例。如果您正苦于以下问题:PHP QueryObject::addOrCondition方法的具体用法?PHP QueryObject::addOrCondition怎么用?PHP QueryObject::addOrCondition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QueryObject
的用法示例。
在下文中一共展示了QueryObject::addOrCondition方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getConsultants
public function getConsultants()
{
$product_name = trim(Convert::raw2sql($this->request->getVar('name')));
$company_id = intval($this->request->getVar('company_id'));
$sort = $this->request->getVar('sort');
$query = new QueryObject(new CompanyService());
$query_draft = new QueryObject(new CompanyServiceDraft());
$query_draft->addAndCondition(QueryCriteria::equal('LiveServiceID', 0));
//only drafts without live version
$query->addAlias(QueryAlias::create('Company'));
$query_draft->addAlias(QueryAlias::create('Company'));
if (!empty($product_name)) {
$query->addOrCondition(QueryCriteria::like('CompanyService.Name', $product_name));
$query->addOrCondition(QueryCriteria::like('Company.Name', $product_name));
$query_draft->addOrCondition(QueryCriteria::like('CompanyService.Name', $product_name));
$query_draft->addOrCondition(QueryCriteria::like('Company.Name', $product_name));
}
if ($company_id > 0) {
$query->addAndCondition(QueryCriteria::equal('Company.ID', $company_id));
$query_draft->addAndCondition(QueryCriteria::equal('Company.ID', $company_id));
}
//set sorting
if (!empty($sort)) {
$dir = $this->getSortDir('consultants');
$this->sortCompanyService($query, $sort, $dir);
$this->sortCompanyService($query_draft, $sort, $dir);
}
//get consultants
list($list1, $size1) = $this->consultant_repository->getAll($query, 0, 1000);
list($list2, $size2) = $this->consultant_draft_repository->getAll($query_draft, 0, 1000);
//return on view model
return new ArrayList(array_merge($list1, $list2));
}