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