当前位置: 首页>>代码示例>>PHP>>正文


PHP Where::isNotNull方法代码示例

本文整理汇总了PHP中Zend\Db\Sql\Where::isNotNull方法的典型用法代码示例。如果您正苦于以下问题:PHP Where::isNotNull方法的具体用法?PHP Where::isNotNull怎么用?PHP Where::isNotNull使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend\Db\Sql\Where的用法示例。


在下文中一共展示了Where::isNotNull方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getCountriesAndCitiesWithSums

 /**
  * @return array country
  */
 public function getCountriesAndCitiesWithSums()
 {
     $adapter = $this->cityCodesTable->getTableGateway()->getAdapter();
     $sql = new Sql($adapter);
     $select = $sql->select();
     $where = new Where();
     $where->isNotNull('l.price');
     $select->from(array('c' => $this->cityCodesTable->getTableName()))->columns(array('ISO2'))->join(array('l' => $this->listingsTable->getTableName()), 'c.ISO2 = l.country', array('total' => new Expression('SUM(price)')))->where($where)->group('c.ISO2');
     //echo $select->getSqlString($this->listingsTable->getAdapter()->getPlatform());
     //exit;
     $list = $adapter->query($select->getSqlString($adapter->getPlatform()), Adapter::QUERY_MODE_EXECUTE);
     $output = array();
     foreach ($list as $row) {
         $output[$row->ISO2] = array('sum' => $row->total, 'cities' => $this->cityCodesTable->getListByCountry($row->ISO2));
     }
     return $output;
 }
开发者ID:jordiwes,项目名称:zf2.unlikelysource.org,代码行数:20,代码来源:TableService.php

示例2: constructWhereFromFilterParams

 /**
  *
  * @param array $filterParams
  * @param bool $testApartments
  * @return Where
  */
 public function constructWhereFromFilterParams($filterParams, $securityLevels = [])
 {
     /* @var $auth \Library\Authentication\BackofficeAuthenticationService */
     $auth = $this->getServiceLocator()->get('library_backoffice_auth');
     $hasDevTestRole = $auth->hasRole(Roles::ROLE_DEVELOPMENT_TESTING);
     $documentsTable = DbTables::TBL_DOCUMENTS;
     $where = new Where();
     if (!$hasDevTestRole) {
         $where->expression('apartment.id NOT IN(' . Constants::TEST_APARTMENT_1 . ', ' . Constants::TEST_APARTMENT_2 . ')', []);
     }
     if (isset($filterParams["validation-range"]) && $filterParams["validation-range"] != '') {
         $tempDatesArray = explode(' - ', $filterParams['validation-range']);
         $validFrom = $tempDatesArray[0];
         $validTo = $tempDatesArray[1];
         $where->expression('DATE(' . $documentsTable . '.valid_from) >= DATE("' . $validFrom . '") ' . 'AND DATE(' . $documentsTable . '.valid_to) <= DATE("' . $validTo . '") ', []);
     }
     if (isset($filterParams['createdDate']) && $filterParams['createdDate'] !== '') {
         $createdDate = explode(' - ', $filterParams['createdDate']);
         $where->between($documentsTable . '.created_date', $createdDate['0'] . ' 00:00:00', $createdDate['1'] . ' 23:59:59');
     }
     if (!empty($filterParams['supplier_id']) && $filterParams['supplier_id'] != '78') {
         $where->equalTo($documentsTable . '.supplier_id', $filterParams['supplier_id']);
     }
     if (!empty($filterParams['document_type'])) {
         $where->equalTo($documentsTable . '.type_id', $filterParams['document_type']);
     }
     if (isset($filterParams['legal_entity_id']) && $filterParams['legal_entity_id'] != 0) {
         $where->equalTo($documentsTable . '.legal_entity_id', $filterParams['legal_entity_id']);
     }
     if (isset($filterParams['signatory_id']) && $filterParams['signatory_id'] != 0) {
         $where->equalTo($documentsTable . '.signatory_id', $filterParams['signatory_id']);
     }
     if (!empty($filterParams['author_id'])) {
         $where->equalTo($documentsTable . '.created_by', $filterParams['author_id']);
     }
     if (!empty($filterParams['account_number'])) {
         $where->like($documentsTable . '.account_number', '%' . $filterParams['account_number'] . '%');
     }
     if (!empty($filterParams['entity_id'])) {
         $where->equalTo($documentsTable . '.entity_id', $filterParams['entity_id']);
     }
     if (!empty($filterParams['entity_type'])) {
         $where->equalTo($documentsTable . '.entity_type', $filterParams['entity_type']);
     }
     if (!empty($filterParams['account_holder'])) {
         $where->like($documentsTable . '.account_holder', '%' . $filterParams['account_holder'] . '%');
     }
     if (!empty($filterParams['has_attachment'])) {
         switch ($filterParams['has_attachment']) {
             case 1:
                 $where->isNotNull($documentsTable . '.attachment')->notEqualTo($documentsTable . '.attachment', '');
                 break;
             case 2:
                 $where->NEST->isNull($documentsTable . '.attachment')->OR->equalTo($documentsTable . '.attachment', '')->UNNEST;
                 break;
         }
     }
     if (isset($filterParams['has_url']) && !empty($filterParams['has_url'])) {
         switch ($filterParams['has_url']) {
             case 1:
                 $where->notEqualTo($documentsTable . '.url', '');
                 break;
             case 2:
                 $where->equalTo($documentsTable . '.url', '');
                 break;
         }
     }
     $hasSecurityAccess = $auth->hasRole(Roles::ROLE_DOCUMENTS_MANAGEMENT_GLOBAL);
     if (isset($securityLevels[0]) && !$hasSecurityAccess) {
         $where->in($documentsTable . '.security_level', $securityLevels);
     }
     return $where;
 }
开发者ID:arbi,项目名称:MyCode,代码行数:79,代码来源:Document.php


注:本文中的Zend\Db\Sql\Where::isNotNull方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。