本文整理汇总了PHP中Zend\Db\Sql\Where::EqualTo方法的典型用法代码示例。如果您正苦于以下问题:PHP Where::EqualTo方法的具体用法?PHP Where::EqualTo怎么用?PHP Where::EqualTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend\Db\Sql\Where
的用法示例。
在下文中一共展示了Where::EqualTo方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: constructWhereFromFilterParams
public function constructWhereFromFilterParams($filterParams)
{
$where = new Where();
$table = DbTables::TBL_BACKOFFICE_USERS;
if (isset($filterParams["group"]) && $filterParams["group"] != '0') {
$where->expression($filterParams["group"] . ' IN (SELECT `group_id` FROM ' . DbTables::TBL_BACKOFFICE_USER_GROUPS . ' WHERE `user_id` = ' . $table . '.id ) ', []);
}
if (isset($filterParams["ud"]) && $filterParams["ud"] != '0') {
$where->expression($filterParams["ud"] . ' IN (SELECT `dashboard_id` FROM ' . DbTables::TBL_BACKOFFICE_USER_DASHBOARDS . ' WHERE `user_id` = ' . $table . '.id ) ', []);
}
if (isset($filterParams["team"]) && $filterParams["team"] != '0') {
$where->expression($filterParams["team"] . ' IN (SELECT `team_id` FROM ' . DbTables::TBL_TEAM_STAFF . ' WHERE `user_id` = ' . $table . '.id AND `type` NOT IN (' . TeamService::STAFF_CREATOR . ', ' . TeamService::STAFF_DIRECTOR . ')) ', []);
}
if (isset($filterParams['city']) && $filterParams['city'] > 0) {
$where->EqualTo('city_id', $filterParams['city']);
}
if (isset($filterParams["system-user-status"])) {
if ($filterParams["system-user-status"] == 1) {
$where->and->EqualTo('system', 0);
} elseif ($filterParams["system-user-status"] == 2) {
$where->and->EqualTo('system', 1);
}
}
if (isset($filterParams["external-user-status"])) {
if ($filterParams["external-user-status"] == 1) {
$where->and->EqualTo('external', 0);
} elseif ($filterParams["external-user-status"] == 2) {
$where->and->EqualTo('external', 1);
}
}
if (isset($filterParams["active-user-status"])) {
if ($filterParams["active-user-status"] == 1) {
$where->and->EqualTo('disabled', 0);
} elseif ($filterParams["active-user-status"] == 2) {
$where->and->EqualTo('disabled', 1);
}
}
if (isset($filterParams["sSearch"]) && $filterParams["sSearch"] != '') {
$nestedWhere = new \Zend\Db\Sql\Predicate\Predicate();
$nestedWhere->like($table . '.firstname', '%' . $filterParams["sSearch"] . '%');
$nestedWhere->OR;
$nestedWhere->like($table . '.lastname', '%' . $filterParams["sSearch"] . '%');
$nestedWhere->OR;
$nestedWhere->like($table . '.position', '%' . $filterParams["sSearch"] . '%');
$nestedWhere->OR;
$nestedWhere->like('details' . '.name', '%' . $filterParams["sSearch"] . '%');
$nestedWhere->OR;
$nestedWhere->like('teams' . '.name', '%' . $filterParams["sSearch"] . '%');
$where->addPredicate($nestedWhere);
}
return $where;
}
示例2: searchData
/**
* Search for records
* @param string $title
* @return array
*/
public function searchData($term)
{
$sql = new Sql($this->tableGateway->getAdapter());
$select = new Select();
$where = new Where();
$where->EqualTo('mobile', $term);
$select->from('contacts')->columns(array('contact_id', 'first_name', 'last_name', 'email', 'mobile'))->where($where);
$select->where($where);
$sql->select();
$statement = $sql->prepareStatementForSqlObject($select);
$result = $statement->execute();
$rows = get_object_vars($result);
// converting two dimensional rows to one dimension
return $rows;
}