本文整理汇总了PHP中QueryGenerator::parseAdvFilterList方法的典型用法代码示例。如果您正苦于以下问题:PHP QueryGenerator::parseAdvFilterList方法的具体用法?PHP QueryGenerator::parseAdvFilterList怎么用?PHP QueryGenerator::parseAdvFilterList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QueryGenerator
的用法示例。
在下文中一共展示了QueryGenerator::parseAdvFilterList方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getRelationQuery
/**
* Function to get Relation query
* @return <String>
*/
public function getRelationQuery()
{
$relationModel = $this->getRelationModel();
if (!empty($relationModel) && $relationModel->get('name') != NULL) {
$recordModel = $this->getParentRecordModel();
$query = $relationModel->getQuery($recordModel, false, $this);
return $query;
}
$searchParams = $this->get('search_params');
if (empty($searchParams)) {
$searchParams = array();
}
$relatedModuleModel = $this->getRelatedModuleModel();
$relatedModuleName = $relatedModuleModel->getName();
$relatedModuleBaseTable = $relatedModuleModel->basetable;
$relatedModuleEntityIdField = $relatedModuleModel->basetableid;
$parentModuleModel = $relationModel->getParentModuleModel();
$parentModuleBaseTable = $parentModuleModel->basetable;
$parentModuleEntityIdField = $parentModuleModel->basetableid;
$parentRecordId = $this->getParentRecordModel()->getId();
$parentModuleDirectRelatedField = $parentModuleModel->get('directRelatedFieldName');
$relatedModuleFields = array_keys($this->getHeaders());
$currentUserModel = Users_Record_Model::getCurrentUserModel();
$queryGenerator = new QueryGenerator($relatedModuleName, $currentUserModel);
$queryGenerator->setFields($relatedModuleFields);
if (count($searchParams) > 0) {
$queryGenerator->parseAdvFilterList($searchParams);
}
$joinQuery = ' INNER JOIN ' . $parentModuleBaseTable . ' ON ' . $parentModuleBaseTable . '.' . $parentModuleDirectRelatedField . " = " . $relatedModuleBaseTable . '.' . $relatedModuleEntityIdField;
$query = $queryGenerator->getQuery();
$queryComponents = spliti(' FROM ', $query);
foreach ($queryComponents as $key => $val) {
if ($key == 0) {
$query = $queryComponents[0] . ' ,vtiger_crmentity.crmid';
} else {
$query .= ' FROM ' . $val;
}
}
$whereSplitQueryComponents = spliti(' WHERE ', $query);
$query = $whereSplitQueryComponents[0] . $joinQuery;
foreach ($whereSplitQueryComponents as $key => $val) {
if ($key == 0) {
$query .= " WHERE {$parentModuleBaseTable}.{$parentModuleEntityIdField} = {$parentRecordId} AND ";
} else {
$query .= $val . ' WHERE ';
}
}
$query = trim($query, "WHERE ");
return $query;
}
示例2: addSearchConditions
public function addSearchConditions($query, $searchParams, $related_module)
{
if (!empty($searchParams)) {
$currentUserModel = Users_Record_Model::getCurrentUserModel();
$queryGenerator = new QueryGenerator($related_module, $currentUserModel);
$queryGenerator->parseAdvFilterList($searchParams);
$where = $queryGenerator->getWhereClause(true);
$query .= $where;
}
return $query;
}