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


PHP ResourceConnection::getTableName方法代碼示例

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


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

示例1: testPrepareProductIndexForBundleProduct

 /**
  * @magentoDataFixture Magento/Bundle/_files/product.php
  * @covers \Magento\Indexer\Model\Indexer::reindexAll
  * @covers \Magento\Bundle\Model\Product\Type::getSearchableData
  */
 public function testPrepareProductIndexForBundleProduct()
 {
     $this->indexer->reindexAll();
     $select = $this->connectionMock->select()->from($this->resource->getTableName('catalogsearch_fulltext_scope1'))->where('`data_index` LIKE ?', '%' . 'Bundle Product Items' . '%');
     $result = $this->connectionMock->fetchAll($select);
     $this->assertCount(1, $result);
 }
開發者ID:kidaa30,項目名稱:magento2-platformsh,代碼行數:12,代碼來源:TypeTest.php

示例2: getLotsByProductId

 public function getLotsByProductId($prodId, $stockId)
 {
     /** @var \Magento\Framework\DB\Adapter\AdapterInterface $conn */
     $conn = $this->_repoGeneric->getConnection();
     /* aliases and tables */
     $asStockItem = 'csi';
     $asQty = 'pwq';
     $asLot = 'pwl';
     $tblStockItem = [$asStockItem => $this->_resource->getTableName(Cfg::ENTITY_MAGE_CATALOGINVENTORY_STOCK_ITEM)];
     $tblQty = [$asQty => $this->_resource->getTableName(Quantity::ENTITY_NAME)];
     $tblLot = [$asLot => $this->_resource->getTableName(Lot::ENTITY_NAME)];
     /* SELECT FROM cataloginventory_stock_item */
     $query = $conn->select();
     $cols = [Alias::AS_STOCK_ITEM_ID => Cfg::E_CATINV_STOCK_ITEM_A_ITEM_ID];
     $query->from($tblStockItem, $cols);
     /* LEFT JOIN prxgt_wrhs_qty pwq */
     $on = $asQty . '.' . Quantity::ATTR_STOCK_ITEM_REF . '=' . $asStockItem . '.' . Cfg::E_CATINV_STOCK_ITEM_A_ITEM_ID;
     $cols = [Alias::AS_QTY => Quantity::ATTR_TOTAL];
     $query->joinLeft($tblQty, $on, $cols);
     // LEFT JOIN prxgt_wrhs_lot pwl
     $on = $asLot . '.' . Lot::ATTR_ID . '=' . $asQty . '.' . Quantity::ATTR_LOT_REF;
     $cols = [Alias::AS_LOT_ID => Lot::ATTR_ID, Alias::AS_LOT_CODE => Lot::ATTR_CODE, Alias::AS_LOT_EXP_DATE => Lot::ATTR_EXP_DATE];
     $query->joinLeft($tblLot, $on, $cols);
     /* where */
     $where = $asStockItem . '.' . Cfg::E_CATINV_STOCK_ITEM_A_PROD_ID . '=' . (int) $prodId;
     $where .= ' AND ' . $asStockItem . '.' . Cfg::E_CATINV_STOCK_ITEM_A_STOCK_ID . '=' . (int) $stockId;
     $query->where($where);
     /* order by */
     $order = $asLot . '.' . Lot::ATTR_EXP_DATE . ' ASC';
     $query->order($order);
     /* fetch data */
     $result = $conn->fetchAll($query);
     return $result;
 }
開發者ID:praxigento,項目名稱:mobi_mod_mage2_warehouse,代碼行數:34,代碼來源:Repo.php

示例3: modifySelect

 /**
  * Add JOINs to original select.
  *
  * @param \Magento\Framework\DB\Select $select
  * @return \Magento\Framework\DB\Select
  */
 public function modifySelect(\Magento\Framework\DB\Select $select)
 {
     /* aliases for tables ... */
     $tblEntity = 'e';
     // this is alias for 'catalog_product_entity' table
     $tblStockItem = $this->_resource->getTableName(self::TBL_STOCK_ITEM);
     $tblWrhsQty = $this->_resource->getTableName(self::TBL_WRHS_QTY);
     /* ... and fields */
     $fldStockItemProdId = StockItem::PRODUCT_ID;
     $fldStockItemId = StockItem::ITEM_ID;
     $fldEntityId = \Magento\Eav\Model\Entity::DEFAULT_ENTITY_ID_FIELD;
     $fldQty = self::FLD_QTY;
     $fldStockItemRef = Quantity::ATTR_STOCK_ITEM_REF;
     /* LEFT JOIN `cataloginventory_stock_item` */
     $on = "`{$tblStockItem}`.`{$fldStockItemProdId}`=`{$tblEntity}`.`{$fldEntityId}`";
     $fields = [];
     $select->joinLeft($tblStockItem, $on, $fields);
     /* LEFT JOIN `prxgt_wrhs_qty` */
     $on = "`{$tblWrhsQty}`.`{$fldStockItemRef}`=`{$tblStockItem}`.`{$fldStockItemId}`";
     $fields = [$fldQty => $this->getEquationQty()];
     $select->joinLeft($tblWrhsQty, $on, $fields);
     /* GROUP BY */
     $select->group("{$tblEntity}.{$fldEntityId}");
     return $select;
 }
開發者ID:praxigento,項目名稱:mobi_mod_mage2_warehouse,代碼行數:31,代碼來源:Grid.php

示例4: build

 /**
  * {@inheritdoc}
  */
 public function build($productId)
 {
     $timestamp = $this->localeDate->scopeTimeStamp($this->storeManager->getStore());
     $currentDate = $this->dateTime->formatDate($timestamp, false);
     $linkField = $this->metadataPool->getMetadata(ProductInterface::class)->getLinkField();
     $productTable = $this->resource->getTableName('catalog_product_entity');
     return [$this->resource->getConnection()->select()->from(['parent' => $productTable], '')->joinInner(['link' => $this->resource->getTableName('catalog_product_relation')], "link.parent_id = parent.{$linkField}", [])->joinInner(['child' => $productTable], "child.entity_id = link.child_id", ['entity_id'])->joinInner(['t' => $this->resource->getTableName('catalogrule_product_price')], 't.product_id = child.entity_id', [])->where('parent.entity_id = ? ', $productId)->where('t.website_id = ?', $this->storeManager->getStore()->getWebsiteId())->where('t.customer_group_id = ?', $this->customerSession->getCustomerGroupId())->where('t.rule_date = ?', $currentDate)->order('t.rule_price ' . Select::SQL_ASC)->limit(1)];
 }
開發者ID:Doability,項目名稱:magento2dev,代碼行數:11,代碼來源:LinkedProductSelectBuilderByCatalogRulePrice.php

示例5: getTable

 /**
  * Get table name (validated by db adapter) by table placeholder
  *
  * @param string|array $tableName
  * @return string
  */
 public function getTable($tableName)
 {
     $cacheKey = $this->_getTableCacheName($tableName);
     if (!isset($this->tables[$cacheKey])) {
         $this->tables[$cacheKey] = $this->resourceModel->getTableName($tableName);
     }
     return $this->tables[$cacheKey];
 }
開發者ID:pradeep-wagento,項目名稱:magento2,代碼行數:14,代碼來源:Setup.php

示例6: doInsert

 public function doInsert()
 {
     $tbl = $this->_resource->getTableName(Account::ENTITY_NAME);
     $bind = [Account::ATTR_CUST_ID => 1, Account::ATTR_ASSET_TYPE_ID => 2, Account::ATTR_BALANCE => 123.45];
     $this->_conn->insert($tbl, $bind);
     $result = $this->_conn->lastInsertId($tbl);
     return $result;
 }
開發者ID:flancer32,項目名稱:sample_mage2_module,代碼行數:8,代碼來源:Call.php

示例7: populateSelect

 public function populateSelect(\Magento\Sales\Model\ResourceModel\Order\Grid\Collection $collection)
 {
     $select = $collection->getSelect();
     /* LEFT JOIN `prxgt_pv_sale` */
     $tbl = [self::AS_TBL_PV_SALES => $this->_resource->getTableName(Sale::ENTITY_NAME)];
     $on = self::AS_TBL_PV_SALES . '.' . Sale::ATTR_SALE_ID . '=main_table.' . Cfg::E_SALE_ORDER_A_ENTITY_ID;
     $cols = [self::AS_FLD_PV_TOTAL => Sale::ATTR_TOTAL, self::AS_FLD_PV_DISCOUNT => Sale::ATTR_DISCOUNT, self::AS_FLD_PV_SUBTOTAL => Sale::ATTR_SUBTOTAL];
     $select->joinLeft($tbl, $on, $cols);
 }
開發者ID:praxigento,項目名稱:mobi_mod_mage2_pv,代碼行數:9,代碼來源:QueryModifier.php

示例8: testAggregate

 /**
  * @magentoDataFixture Magento/Review/_files/customer_review_with_rating.php
  */
 public function testAggregate()
 {
     $rating = $this->reviewCollection->getFirstItem();
     $this->reviewResource->aggregate($rating);
     $select = $this->connection->select()->from($this->resource->getTableName('review_entity_summary'));
     $result = $this->connection->fetchRow($select);
     $this->assertEquals(1, $result['reviews_count']);
     $this->assertEquals(40, $result['rating_summary']);
 }
開發者ID:kidaa30,項目名稱:magento2-platformsh,代碼行數:12,代碼來源:ReviewTest.php

示例9: getIds

 /**
  * @param array $ids
  * @return array
  */
 public function getIds(array $ids)
 {
     $key = md5(json_encode($ids));
     if (!isset($this->productIds[$key])) {
         $connection = $this->resource->getConnection();
         $this->productIds[$key] = $connection->fetchCol($connection->select()->from(['e' => $this->resource->getTableName('catalog_product_entity')], ['e.entity_id'])->where('e.type_id = ?', \Magento\ConfigurableProduct\Model\Product\Type\Configurable::TYPE_CODE)->where('e.entity_id IN (?)', $ids));
     }
     return $this->productIds[$key];
 }
開發者ID:BlackIkeEagle,項目名稱:magento2-continuousphp,代碼行數:13,代碼來源:ConfigurableProductsProvider.php

示例10: beforeLoad

 /**
  * @param Collection $productCollection
  * @param bool $printQuery
  * @param bool $logQuery
  * @return array
  */
 public function beforeLoad(Collection $productCollection, $printQuery = false, $logQuery = false)
 {
     if (!$productCollection->hasFlag('catalog_rule_loaded')) {
         $connection = $this->resource->getConnection();
         $store = $this->storeManager->getStore();
         $productCollection->getSelect()->joinLeft(['catalog_rule' => $this->resource->getTableName('catalogrule_product_price')], implode(' AND ', ['catalog_rule.product_id = e.entity_id', $connection->quoteInto('catalog_rule.website_id = ?', $store->getWebsiteId()), $connection->quoteInto('catalog_rule.customer_group_id = ?', $this->customerSession->getCustomerGroupId()), $connection->quoteInto('catalog_rule.rule_date = ?', $this->dateTime->formatDate($this->localeDate->scopeDate($store->getId()), false))]), [CatalogRulePrice::PRICE_CODE => 'rule_price']);
         $productCollection->setFlag('catalog_rule_loaded', true);
     }
     return [$printQuery, $logQuery];
 }
開發者ID:Doability,項目名稱:magento2dev,代碼行數:16,代碼來源:AddCatalogRulePrice.php

示例11: populateSelect

 public function populateSelect(\Magento\Sales\Model\ResourceModel\Order\Grid\Collection $collection)
 {
     $select = $collection->getSelect();
     /* LEFT JOIN `prxgt_odoo_sale` */
     $tbl = [self::AS_TBL_ODOO_SALE => $this->_resource->getTableName(SaleOrder::ENTITY_NAME)];
     $on = self::AS_TBL_ODOO_SALE . '.' . SaleOrder::ATTR_MAGE_REF . '=main_table.' . Cfg::E_SALE_ORDER_A_ENTITY_ID;
     $exp = new Expression('!ISNULL(' . self::AS_TBL_ODOO_SALE . '.' . SaleOrder::ATTR_MAGE_REF . ')');
     $cols = [self::AS_FLD_IS_IN_ODOO => $exp];
     $select->joinLeft($tbl, $on, $cols);
     return $select;
 }
開發者ID:praxigento,項目名稱:mobi_mod_mage2_odoo,代碼行數:11,代碼來源:QueryModifier.php

示例12: aroundGetReport

 public function aroundGetReport(\Magento\Framework\View\Element\UiComponent\DataProvider\CollectionFactory $subject, \Closure $proceed, $requestName)
 {
     $result = $proceed($requestName);
     if ($requestName == 'sales_order_grid_data_source') {
         if ($result instanceof \Magento\Sales\Model\ResourceModel\Order\Grid\Collection) {
             $select = $result->getSelect();
             $select->joinLeft(['shipper_order_join' => $this->_resource->getTableName('shipperhq_order_detail_grid')], 'entity_id' . '=shipper_order_join.' . 'order_id', []);
         }
     }
     return $result;
 }
開發者ID:shipperhq,項目名稱:module-shipper,代碼行數:11,代碼來源:CollectionFactory.php

示例13: testGetTableName

 public function testGetTableName()
 {
     $tablePrefix = 'prefix_';
     $tableSuffix = 'suffix';
     $tableNameOrig = 'store_website';
     $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\\Framework\\App\\ResourceConnection', ['tablePrefix' => 'prefix_']);
     $tableName = $this->_model->getTableName([$tableNameOrig, $tableSuffix]);
     $this->assertContains($tablePrefix, $tableName);
     $this->assertContains($tableSuffix, $tableName);
     $this->assertContains($tableNameOrig, $tableName);
 }
開發者ID:whoople,項目名稱:magento2-testing,代碼行數:11,代碼來源:ResourceTest.php

示例14: createTemporaryTable

 /**
  * @return Table
  * @throws \Zend_Db_Exception
  */
 private function createTemporaryTable()
 {
     $connection = $this->getConnection();
     $tableName = $this->resource->getTableName(str_replace('.', '_', uniqid(self::TEMPORARY_TABLE_PREFIX, true)));
     $table = $connection->newTable($tableName);
     $connection->dropTemporaryTable($table->getName());
     $table->addColumn(self::FIELD_ENTITY_ID, Table::TYPE_INTEGER, 10, ['unsigned' => true, 'nullable' => false, 'primary' => true], 'Entity ID');
     $table->addColumn(self::FIELD_SCORE, Table::TYPE_DECIMAL, [32, 16], ['unsigned' => true, 'nullable' => false], 'Score');
     $table->setOption('type', 'memory');
     $connection->createTemporaryTable($table);
     return $table;
 }
開發者ID:pradeep-wagento,項目名稱:magento2,代碼行數:16,代碼來源:TemporaryStorage.php

示例15: generateSequences

 /**
  * @param int $n
  * @return void
  */
 public function generateSequences($n = 10)
 {
     $connection = $this->appResource->getConnection();
     for ($i = 0; $i < $n; $i++) {
         foreach ($this->entities as $entityName) {
             $sequenceName = $this->appResource->getTableName(sprintf('sequence_%s_%s', $entityName, $i));
             if (!$connection->isTableExists($sequenceName)) {
                 $connection->query($this->ddlSequence->getCreateSequenceDdl($sequenceName));
             }
         }
     }
 }
開發者ID:kidaa30,項目名稱:magento2-platformsh,代碼行數:16,代碼來源:Sequence.php


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