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


PHP Select::join方法代碼示例

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


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

示例1: applyPriceRuleToIndexTable

 /**
  * Apply price rule price to price index table
  *
  * @param \Magento\Framework\DB\Select $select
  * @param array|string $indexTable
  * @param string $entityId
  * @param string $customerGroupId
  * @param string $websiteId
  * @param array $updateFields       the array of fields for compare with rule price and update
  * @param string $websiteDate
  * @return \Magento\CatalogRule\Model\ResourceModel\Rule\Product\Price
  */
 public function applyPriceRuleToIndexTable(\Magento\Framework\DB\Select $select, $indexTable, $entityId, $customerGroupId, $websiteId, $updateFields, $websiteDate)
 {
     if (empty($updateFields)) {
         return $this;
     }
     if (is_array($indexTable)) {
         foreach ($indexTable as $k => $v) {
             if (is_string($k)) {
                 $indexAlias = $k;
             } else {
                 $indexAlias = $v;
             }
             break;
         }
     } else {
         $indexAlias = $indexTable;
     }
     $select->join(['rp' => $this->getMainTable()], "rp.rule_date = {$websiteDate}", [])->where("rp.product_id = {$entityId} AND rp.website_id = {$websiteId} AND rp.customer_group_id = {$customerGroupId}");
     foreach ($updateFields as $priceField) {
         $priceCond = $this->getConnection()->quoteIdentifier([$indexAlias, $priceField]);
         $priceExpr = $this->getConnection()->getCheckSql("rp.rule_price < {$priceCond}", 'rp.rule_price', $priceCond);
         $select->columns([$priceField => $priceExpr]);
     }
     $query = $select->crossUpdateFromSelect($indexTable);
     $this->getConnection()->query($query);
     return $this;
 }
開發者ID:pradeep-wagento,項目名稱:magento2,代碼行數:39,代碼來源:Price.php

示例2: _addFilter

 /**
  * Add attribute to filter
  *
  * @param int $storeId
  * @param string $attributeCode
  * @param mixed $value
  * @param string $type
  * @return \Magento\Framework\DB\Select|bool
  */
 protected function _addFilter($storeId, $attributeCode, $value, $type = '=')
 {
     if (!$this->_select instanceof \Magento\Framework\DB\Select) {
         return false;
     }
     if (!isset($this->_attributesCache[$attributeCode])) {
         $attribute = $this->_categoryResource->getAttribute($attributeCode);
         $this->_attributesCache[$attributeCode] = ['entity_type_id' => $attribute->getEntityTypeId(), 'attribute_id' => $attribute->getId(), 'table' => $attribute->getBackend()->getTable(), 'is_global' => $attribute->getIsGlobal(), 'backend_type' => $attribute->getBackendType()];
     }
     $attribute = $this->_attributesCache[$attributeCode];
     switch ($type) {
         case '=':
             $conditionRule = '=?';
             break;
         case 'in':
             $conditionRule = ' IN(?)';
             break;
         default:
             return false;
             break;
     }
     if ($attribute['backend_type'] == 'static') {
         $this->_select->where('e.' . $attributeCode . $conditionRule, $value);
     } else {
         $this->_select->join(['t1_' . $attributeCode => $attribute['table']], 'e.entity_id = t1_' . $attributeCode . '.entity_id AND t1_' . $attributeCode . '.store_id = 0', [])->where('t1_' . $attributeCode . '.attribute_id=?', $attribute['attribute_id']);
         if ($attribute['is_global']) {
             $this->_select->where('t1_' . $attributeCode . '.value' . $conditionRule, $value);
         } else {
             $ifCase = $this->getConnection()->getCheckSql('t2_' . $attributeCode . '.value_id > 0', 't2_' . $attributeCode . '.value', 't1_' . $attributeCode . '.value');
             $this->_select->joinLeft(['t2_' . $attributeCode => $attribute['table']], $this->getConnection()->quoteInto('t1_' . $attributeCode . '.entity_id = t2_' . $attributeCode . '.entity_id AND t1_' . $attributeCode . '.attribute_id = t2_' . $attributeCode . '.attribute_id AND t2_' . $attributeCode . '.store_id=?', $storeId), [])->where('(' . $ifCase . ')' . $conditionRule, $value);
         }
     }
     return $this->_select;
 }
開發者ID:whoople,項目名稱:magento2-testing,代碼行數:43,代碼來源:Category.php

示例3: _addProductWebsiteJoinToSelect

 /**
  * Add join for catalog/product_website table
  * Joined table has alias pw
  *
  * @param \Magento\Framework\DB\Select $select the select object
  * @param string|\Zend_Db_Expr $website the limitation of website_id
  * @param string|\Zend_Db_Expr $product the limitation of product_id
  * @return $this
  */
 protected function _addProductWebsiteJoinToSelect($select, $website, $product)
 {
     $select->join(['pw' => $this->getTable('catalog_product_website')], "pw.product_id = {$product} AND pw.website_id = {$website}", []);
     return $this;
 }
開發者ID:Doability,項目名稱:magento2dev,代碼行數:14,代碼來源:AbstractIndexer.php

示例4: prepareCatalogProductIndexSelect

 /**
  * Add stock status limitation to catalog product price index select object
  *
  * @param \Magento\Framework\DB\Select $select
  * @param string|\Zend_Db_Expr $entityField
  * @param string|\Zend_Db_Expr $websiteField
  * @return $this
  */
 public function prepareCatalogProductIndexSelect(\Magento\Framework\DB\Select $select, $entityField, $websiteField)
 {
     $select->join(array('ciss' => $this->getMainTable()), "ciss.product_id = {$entityField} AND ciss.website_id = {$websiteField}", array());
     $select->where('ciss.stock_status = ?', Stock\Status::STATUS_IN_STOCK);
     return $this;
 }
開發者ID:Atlis,項目名稱:docker-magento2,代碼行數:14,代碼來源:Status.php

示例5: applyCondition

 protected function applyCondition(Select $select)
 {
     $select->join(['id' => $this->tableName], 'attribute.entity_id = id.entity_id', []);
 }
開發者ID:EcomDev,項目名稱:mysql-performance-benchmark,代碼行數:4,代碼來源:MemoryTable.php

示例6: limitFlatActive

 public function limitFlatActive(Select $select, $alias = 'main')
 {
     $select->join(['flat' => $this->getTable('entity_flat')], $alias . '.entity_id = flat.entity_id', []);
     $select->where('flat.scope_id = ?', $this->scope->getId($this->scopeCode));
     $select->where('flat.is_active = ?', 1);
     return $this;
 }
開發者ID:EcomDev,項目名稱:mysql-performance-benchmark,代碼行數:7,代碼來源:AbstractProvider.php


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