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


PHP Select::reset方法代碼示例

本文整理匯總了PHP中Magento\Framework\DB\Select::reset方法的典型用法代碼示例。如果您正苦於以下問題:PHP Select::reset方法的具體用法?PHP Select::reset怎麽用?PHP Select::reset使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Magento\Framework\DB\Select的用法示例。


在下文中一共展示了Select::reset方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: reset

 /**
  * Resets select object
  *
  * @param null $part
  * @return $this
  */
 public function reset($part = null)
 {
     if ($part === self::COLUMNS || $part === null) {
         $this->outfile = false;
     }
     return parent::reset($part);
 }
開發者ID:EcomDev,項目名稱:mysql-performance-benchmark,代碼行數:13,代碼來源:Select.php

示例2: getProductCountSelect

 /**
  * Retrieve product count select for categories
  *
  * @return \Magento\Framework\DB\Select
  */
 public function getProductCountSelect()
 {
     if ($this->_productCountSelect === null) {
         $this->_productCountSelect = clone $this->getSelect();
         $this->_productCountSelect->reset(\Magento\Framework\DB\Select::COLUMNS)->reset(\Magento\Framework\DB\Select::GROUP)->reset(\Magento\Framework\DB\Select::ORDER)->distinct(false)->join(['count_table' => $this->getTable('catalog_category_product_index')], 'count_table.product_id = e.entity_id', ['count_table.category_id', 'product_count' => new \Zend_Db_Expr('COUNT(DISTINCT count_table.product_id)')])->where('count_table.store_id = ?', $this->getStoreId())->group('count_table.category_id');
     }
     return $this->_productCountSelect;
 }
開發者ID:Doability,項目名稱:magento2dev,代碼行數:13,代碼來源:Collection.php

示例3: exists

 /**
  * Add EXISTS clause
  *
  * @param  Select $select
  * @param  string           $joinCondition
  * @param   bool            $isExists
  * @return $this
  */
 public function exists($select, $joinCondition, $isExists = true)
 {
     if ($isExists) {
         $exists = 'EXISTS (%s)';
     } else {
         $exists = 'NOT EXISTS (%s)';
     }
     $select->reset(self::COLUMNS)->columns([new \Zend_Db_Expr('1')])->where($joinCondition);
     $exists = sprintf($exists, $select->assemble());
     $this->where($exists);
     return $this;
 }
開發者ID:tingyeeh,項目名稱:magento2,代碼行數:20,代碼來源:Select.php

示例4: _prepareHaving

 /**
  * Prepare and returns having array
  *
  * @param \Magento\Framework\DB\Select $select
  * @param bool $autoReset
  * @return array
  * @throws \Zend_Db_Exception
  */
 protected function _prepareHaving(\Magento\Framework\DB\Select $select, $autoReset = false)
 {
     $selectHavings = $select->getPart(\Zend_Db_Select::HAVING);
     if (!$selectHavings) {
         return [];
     }
     $havings = [];
     $columns = $select->getPart(\Zend_Db_Select::COLUMNS);
     foreach ($columns as $columnEntry) {
         $correlationName = (string) $columnEntry[1];
         $column = $columnEntry[2];
         foreach ($selectHavings as $having) {
             /**
              * Looking for column expression in the having clause
              */
             if (strpos($having, $correlationName) !== false) {
                 if (is_string($column)) {
                     /**
                      * Replace column expression to column alias in having clause
                      */
                     $havings[] = str_replace($correlationName, $column, $having);
                 } else {
                     throw new \Zend_Db_Exception(sprintf("Can't prepare expression without column alias: '%s'", $correlationName));
                 }
             }
         }
     }
     if ($autoReset) {
         $select->reset(\Zend_Db_Select::HAVING);
     }
     return $havings;
 }
開發者ID:shabbirvividads,項目名稱:magento2,代碼行數:40,代碼來源:Helper.php


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