當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Where::EqualTo方法代碼示例

本文整理匯總了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;
 }
開發者ID:arbi,項目名稱:MyCode,代碼行數:52,代碼來源:User.php

示例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;
 }
開發者ID:hejames,項目名稱:jTrContact,代碼行數:20,代碼來源:ContactTable.php


注:本文中的Zend\Db\Sql\Where::EqualTo方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。