当前位置: 首页>>代码示例>>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;未经允许,请勿转载。