• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP App\ResourceConnection类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Magento\Framework\App\ResourceConnection的典型用法代码示例。如果您正苦于以下问题:PHP ResourceConnection类的具体用法?PHP ResourceConnection怎么用?PHP ResourceConnection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: setUp

 protected function setUp()
 {
     $this->_adapterMock = $this->getMock('Magento\\Framework\\DB\\Adapter\\AdapterInterface');
     $this->_resourceMock = $this->getMock('Magento\\Framework\\App\\ResourceConnection', [], [], '', false);
     $this->_resourceMock->expects($this->any())->method('getConnection')->with('prefix')->will($this->returnValue($this->_adapterMock));
     $this->_model = $this->getMockForAbstractClass('Magento\\Framework\\DB\\Helper\\AbstractHelper', [$this->_resourceMock, 'prefix'], '', true, true, true, ['addLikeEscape']);
 }
开发者ID:IlyaGluschenko,项目名称:test001,代码行数:7,代码来源:AbstractHelperTest.php


示例2: setUp

 protected function setUp()
 {
     $objectManager = new ObjectManager($this);
     $this->connection = $this->getMockBuilder('\\Magento\\Framework\\DB\\Adapter\\AdapterInterface')->disableOriginalConstructor()->getMock();
     $this->connection->expects($this->any())->method('quoteInto')->willReturnCallback(function ($query, $expression) {
         return str_replace('?', $expression, $query);
     });
     $this->resource = $this->getMockBuilder('\\Magento\\Framework\\App\\ResourceConnection')->disableOriginalConstructor()->getMock();
     $this->resource->method('getTableName')->willReturnCallback(function ($table) {
         return 'prefix_' . $table;
     });
     $this->resource->expects($this->any())->method('getConnection')->willReturn($this->connection);
     $this->website = $this->getMockBuilder('\\Magento\\Store\\Api\\Data\\WebsiteInterface')->disableOriginalConstructor()->getMockForAbstractClass();
     $this->website->expects($this->any())->method('getId')->willReturn(self::WEBSITE_ID);
     $this->store = $this->getMockBuilder('\\Magento\\Store\\Api\\Data\\StoreInterface')->disableOriginalConstructor()->getMockForAbstractClass();
     $this->store->expects($this->any())->method('getId')->willReturn(self::STORE_ID);
     $this->storeManager = $this->getMockBuilder('\\Magento\\Store\\Model\\StoreManagerInterface')->disableOriginalConstructor()->getMock();
     $this->storeManager->expects($this->any())->method('getWebsite')->willReturn($this->website);
     $this->storeManager->expects($this->any())->method('getStore')->willReturn($this->store);
     $this->attributeCollection = $this->getMockBuilder('\\Magento\\Catalog\\Model\\ResourceModel\\Product\\Attribute\\Collection')->disableOriginalConstructor()->getMock();
     $attributeCollectionFactory = $this->getMockBuilder('\\Magento\\Catalog\\Model\\ResourceModel\\Product\\Attribute\\CollectionFactory')->setMethods(['create'])->disableOriginalConstructor()->getMock();
     $attributeCollectionFactory->expects($this->once())->method('create')->willReturn($this->attributeCollection);
     $this->target = $objectManager->getObject('\\Magento\\CatalogSearch\\Model\\Search\\TableMapper', ['resource' => $this->resource, 'storeManager' => $this->storeManager, 'attributeCollectionFactory' => $attributeCollectionFactory]);
     $this->select = $this->getMockBuilder('\\Magento\\Framework\\DB\\Select')->disableOriginalConstructor()->getMock();
     $this->request = $this->getMockBuilder('\\Magento\\Framework\\Search\\RequestInterface')->disableOriginalConstructor()->getMock();
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:26,代码来源:TableMapperTest.php


示例3: getConnection

 /**
  * Returns Adapter interface
  *
  * @return array \Magento\Framework\DB\Adapter\AdapterInterface
  */
 public function getConnection()
 {
     if (!$this->connection) {
         $this->connection = $this->resource->getConnection(\Magento\Framework\App\ResourceConnection::DEFAULT_CONNECTION);
     }
     return $this->connection;
 }
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:12,代码来源:InvoiceItemInterfacePersistor.php


示例4: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->setCollectionFactory = $this->getMock('Magento\\Eav\\Model\\ResourceModel\\Entity\\Attribute\\Set\\CollectionFactory', ['create'], [], '', false);
     $this->setCollection = $this->getMock('Magento\\Eav\\Model\\ResourceModel\\Entity\\Attribute\\Set\\Collection', ['setEntityTypeFilter'], [], '', false);
     $this->setCollectionFactory->expects($this->any())->method('create')->will($this->returnValue($this->setCollection));
     $this->setCollection->expects($this->any())->method('setEntityTypeFilter')->will($this->returnValue([]));
     $this->attrCollectionFactory = $this->getMock('Magento\\Catalog\\Model\\ResourceModel\\Product\\Attribute\\CollectionFactory', ['create', 'addFieldToFilter'], [], '', false);
     $this->attrCollectionFactory->expects($this->any())->method('create')->will($this->returnSelf());
     $this->attrCollectionFactory->expects($this->any())->method('addFieldToFilter')->willReturn([]);
     $this->entityModel = $this->getMock('Magento\\CatalogImportExport\\Model\\Import\\Product', ['getErrorAggregator', 'getNewSku', 'getOldSku', 'getNextBunch', 'isRowAllowedToImport', 'getRowScope'], [], '', false);
     $this->entityModel->method('getErrorAggregator')->willReturn($this->getErrorAggregatorObject());
     $this->params = [0 => $this->entityModel, 1 => 'grouped'];
     $this->links = $this->getMock('Magento\\GroupedImportExport\\Model\\Import\\Product\\Type\\Grouped\\Links', [], [], '', false);
     $entityAttributes = [['attribute_set_name' => 'attribute_id', 'attribute_id' => 'attributeSetName']];
     $this->connection = $this->getMock('Magento\\Framework\\DB\\Adapter\\Pdo\\Mysql', ['select', 'fetchAll', 'fetchPairs', 'joinLeft', 'insertOnDuplicate', 'delete', 'quoteInto'], [], '', false);
     $this->select = $this->getMock('Magento\\Framework\\DB\\Select', ['from', 'where', 'joinLeft', 'getConnection'], [], '', false);
     $this->select->expects($this->any())->method('from')->will($this->returnSelf());
     $this->select->expects($this->any())->method('where')->will($this->returnSelf());
     $this->select->expects($this->any())->method('joinLeft')->will($this->returnSelf());
     $this->connection->expects($this->any())->method('select')->will($this->returnValue($this->select));
     $connectionMock = $this->getMock('Magento\\Framework\\DB\\Adapter\\Pdo\\Mysql', [], [], '', false);
     $connectionMock->expects($this->any())->method('quoteInto')->will($this->returnValue('query'));
     $this->select->expects($this->any())->method('getConnection')->willReturn($connectionMock);
     $this->connection->expects($this->any())->method('insertOnDuplicate')->willReturnSelf();
     $this->connection->expects($this->any())->method('delete')->willReturnSelf();
     $this->connection->expects($this->any())->method('quoteInto')->willReturn('');
     $this->connection->expects($this->any())->method('fetchAll')->will($this->returnValue($entityAttributes));
     $this->resource = $this->getMock('\\Magento\\Framework\\App\\ResourceConnection', ['getConnection', 'getTableName'], [], '', false);
     $this->resource->expects($this->any())->method('getConnection')->will($this->returnValue($this->connection));
     $this->resource->expects($this->any())->method('getTableName')->will($this->returnValue('tableName'));
     $this->grouped = $this->objectManagerHelper->getObject('Magento\\GroupedImportExport\\Model\\Import\\Product\\Type\\Grouped', ['attrSetColFac' => $this->setCollectionFactory, 'prodAttrColFac' => $this->attrCollectionFactory, 'resource' => $this->resource, 'params' => $this->params, 'links' => $this->links]);
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:33,代码来源:GroupedTest.php


示例5: setUp

 /**
  * {@inheritDoc}
  */
 protected function setUp()
 {
     $this->resourceMock = $this->getMockBuilder('Magento\\Framework\\App\\ResourceConnection')->disableOriginalConstructor()->getMock();
     $this->connectionMock = $this->getMockBuilder('Magento\\Framework\\DB\\Adapter\\AdapterInterface')->getMock();
     $this->resourceMock->expects($this->any())->method('getConnection')->willReturn($this->connectionMock);
     $this->helper = new Helper($this->resourceMock);
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:10,代码来源:HelperTest.php


示例6: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->entityModel = $this->getMock('Magento\\CatalogImportExport\\Model\\Import\\Product', ['getErrorAggregator', 'getBehavior', 'getNewSku', 'getNextBunch', 'isRowAllowedToImport', 'getRowScope', 'getConnection'], [], '', false);
     $this->entityModel->method('getErrorAggregator')->willReturn($this->getErrorAggregatorObject());
     $this->connection = $this->getMock('Magento\\Framework\\DB\\Adapter\\Pdo\\Mysql', ['select', 'fetchAll', 'fetchPairs', 'joinLeft', 'insertOnDuplicate', 'delete', 'quoteInto', 'fetchAssoc'], [], '', false);
     $this->select = $this->getMock('Magento\\Framework\\DB\\Select', [], [], '', false);
     $this->select->expects($this->any())->method('from')->will($this->returnSelf());
     $this->select->expects($this->any())->method('where')->will($this->returnSelf());
     $this->select->expects($this->any())->method('joinLeft')->will($this->returnSelf());
     $this->select->expects($this->any())->method('getConnection')->willReturn($this->connection);
     $this->connection->expects($this->any())->method('select')->will($this->returnValue($this->select));
     $this->initFetchAllCalls();
     $this->connection->expects($this->any())->method('insertOnDuplicate')->willReturnSelf();
     $this->connection->expects($this->any())->method('delete')->willReturnSelf();
     $this->connection->expects($this->any())->method('quoteInto')->willReturn('');
     $this->resource = $this->getMock('Magento\\Framework\\App\\ResourceConnection', ['getConnection', 'getTableName'], [], '', false);
     $this->resource->expects($this->any())->method('getConnection')->will($this->returnValue($this->connection));
     $this->resource->expects($this->any())->method('getTableName')->will($this->returnValue('tableName'));
     $this->attrSetColFac = $this->getMock('Magento\\Eav\\Model\\ResourceModel\\Entity\\Attribute\\Set\\CollectionFactory', ['create'], [], '', false);
     $this->setCollection = $this->getMock('Magento\\Eav\\Model\\ResourceModel\\Entity\\Attribute\\Set\\Collection', ['setEntityTypeFilter'], [], '', false);
     $this->attrSetColFac->expects($this->any())->method('create')->will($this->returnValue($this->setCollection));
     $this->setCollection->expects($this->any())->method('setEntityTypeFilter')->will($this->returnValue([]));
     $this->prodAttrColFac = $this->getMock('Magento\\Catalog\\Model\\ResourceModel\\Product\\Attribute\\CollectionFactory', ['create'], [], '', false);
     $attrCollection = $this->getMock('\\Magento\\Catalog\\Model\\ResourceModel\\Product\\Attribute\\Collection', [], [], '', false);
     $attrCollection->expects($this->any())->method('addFieldToFilter')->willReturn([]);
     $this->prodAttrColFac->expects($this->any())->method('create')->will($this->returnValue($attrCollection));
     $this->params = [0 => $this->entityModel, 1 => 'bundle'];
     $this->bundle = $this->objectManagerHelper->getObject('Magento\\BundleImportExport\\Model\\Import\\Product\\Type\\Bundle', ['attrSetColFac' => $this->attrSetColFac, 'prodAttrColFac' => $this->prodAttrColFac, 'resource' => $this->resource, 'params' => $this->params]);
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:30,代码来源:BundleTest.php


示例7: setUp

 protected function setUp()
 {
     $this->coreEntityFactoryMock = $this->getMock('Magento\\Framework\\Data\\Collection\\EntityFactory', [], [], '', false);
     $this->loggerMock = $this->getMock('Psr\\Log\\LoggerInterface');
     $this->fetchStrategyMock = $this->getMock('Magento\\Framework\\Data\\Collection\\Db\\FetchStrategyInterface', [], [], '', false);
     $this->eventManagerMock = $this->getMock('Magento\\Framework\\Event\\ManagerInterface', [], [], '', false);
     $this->configMock = $this->getMock('Magento\\Eav\\Model\\Config', [], [], '', false);
     $this->coreResourceMock = $this->getMock('Magento\\Framework\\App\\ResourceConnection', [], [], '', false);
     $this->resourceHelperMock = $this->getMock('Magento\\Eav\\Model\\ResourceModel\\Helper', [], [], '', false);
     $this->validatorFactoryMock = $this->getMock('Magento\\Framework\\Validator\\UniversalFactory', [], [], '', false);
     $this->entityFactoryMock = $this->getMock('Magento\\Eav\\Model\\EntityFactory', [], [], '', false);
     /** @var \Magento\Framework\DB\Adapter\AdapterInterface|\PHPUnit_Framework_MockObject_MockObject */
     $connectionMock = $this->getMock('Magento\\Framework\\DB\\Adapter\\Pdo\\Mysql', [], [], '', false);
     $this->statementMock = $this->getMock('Magento\\Framework\\DB\\Statement\\Pdo\\Mysql', ['fetch'], [], '', false);
     /** @var $selectMock \Magento\Framework\DB\Select|\PHPUnit_Framework_MockObject_MockObject */
     $selectMock = $this->getMock('Magento\\Framework\\DB\\Select', [], [], '', false);
     $this->coreEntityFactoryMock->expects($this->any())->method('create')->will($this->returnCallback([$this, 'getMagentoObject']));
     $connectionMock->expects($this->any())->method('select')->will($this->returnValue($selectMock));
     $connectionMock->expects($this->any())->method('query')->willReturn($this->statementMock);
     $this->coreResourceMock->expects($this->any())->method('getConnection')->will($this->returnValue($connectionMock));
     $entityMock = $this->getMock('Magento\\Eav\\Model\\Entity\\AbstractEntity', [], [], '', false);
     $entityMock->expects($this->any())->method('getConnection')->will($this->returnValue($connectionMock));
     $entityMock->expects($this->any())->method('getDefaultAttributes')->will($this->returnValue([]));
     $this->validatorFactoryMock->expects($this->any())->method('create')->with('test_entity_model')->will($this->returnValue($entityMock));
     $this->model = new AbstractCollectionStub($this->coreEntityFactoryMock, $this->loggerMock, $this->fetchStrategyMock, $this->eventManagerMock, $this->configMock, $this->coreResourceMock, $this->entityFactoryMock, $this->resourceHelperMock, $this->validatorFactoryMock, null);
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:26,代码来源:AbstractCollectionTest.php


示例8: __construct

 /**
  * @param ResourceConnection $resource
  * @param \Magento\Store\Model\StoreManagerInterface $storeManager
  * @param \Magento\Catalog\Model\ResourceModel\Helper $resourceHelper
  */
 public function __construct(ResourceConnection $resource, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Catalog\Model\ResourceModel\Helper $resourceHelper)
 {
     $this->resource = $resource;
     $this->connection = $resource->getConnection();
     $this->storeManager = $storeManager;
     $this->resourceHelper = $resourceHelper;
     $this->columns = array_merge($this->getStaticColumns(), $this->getEavColumns());
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:13,代码来源:AbstractAction.php


示例9: getConnection

 public function getConnection($name = null)
 {
     if (is_null($name)) {
         $name = \Magento\Framework\App\ResourceConnection::DEFAULT_CONNECTION;
     }
     $result = $this->_resource->getConnection($name);
     return $result;
 }
开发者ID:praxigento,项目名称:mobi_mod_mage2_core,代码行数:8,代码来源:Db.php


示例10: __construct

 /**
  * @param Config $eavConfig
  * @param ResourceConnection $resource
  * @param ScopeResolverInterface $scopeResolver
  * @param Session $customerSession
  */
 public function __construct(Config $eavConfig, ResourceConnection $resource, ScopeResolverInterface $scopeResolver, Session $customerSession)
 {
     $this->eavConfig = $eavConfig;
     $this->resource = $resource;
     $this->connection = $resource->getConnection();
     $this->scopeResolver = $scopeResolver;
     $this->customerSession = $customerSession;
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:14,代码来源:DataProvider.php


示例11: __construct

 /**
  * @param \Magento\Framework\Model\Context $context
  * @param \Magento\Framework\Registry $registry
  * @param \Magento\Framework\App\Config\ScopeConfigInterface $config
  * @param \Magento\Framework\App\Cache\TypeListInterface $cacheTypeList
  * @param \Magento\UrlRewrite\Helper\UrlRewrite $urlRewriteHelper
  * @param \Magento\Store\Model\StoreManagerInterface $storeManager
  * @param ResourceConnection $appResource
  * @param \Magento\UrlRewrite\Model\UrlFinderInterface $urlFinder
  * @param \Magento\Framework\Model\ResourceModel\AbstractResource|null $resource
  * @param \Magento\Framework\Data\Collection\AbstractDb|null $resourceCollection
  * @param array $data
  * @SuppressWarnings(PHPMD.ExcessiveParameterList)
  */
 public function __construct(\Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, \Magento\Framework\App\Config\ScopeConfigInterface $config, \Magento\Framework\App\Cache\TypeListInterface $cacheTypeList, \Magento\UrlRewrite\Helper\UrlRewrite $urlRewriteHelper, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Framework\App\ResourceConnection $appResource, \Magento\UrlRewrite\Model\UrlFinderInterface $urlFinder, \Magento\Framework\Model\ResourceModel\AbstractResource $resource = null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null, array $data = [])
 {
     parent::__construct($context, $registry, $config, $cacheTypeList, $resource, $resourceCollection, $data);
     $this->urlRewriteHelper = $urlRewriteHelper;
     $this->connection = $appResource->getConnection();
     $this->urlFinder = $urlFinder;
     $this->storeManager = $storeManager;
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:22,代码来源:Suffix.php


示例12: __construct

 /**
  * @param \Magento\Catalog\Helper\Product\Flat\Indexer $productIndexerHelper
  * @param \Magento\Framework\App\ResourceConnection $resource
  * @param \Magento\Framework\App\Config\ScopeConfigInterface $config
  * @param \Magento\Store\Model\StoreManagerInterface $storeManager
  * @param TableDataInterface $tableData
  */
 public function __construct(\Magento\Catalog\Helper\Product\Flat\Indexer $productIndexerHelper, \Magento\Framework\App\ResourceConnection $resource, \Magento\Framework\App\Config\ScopeConfigInterface $config, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Catalog\Model\Indexer\Product\Flat\TableDataInterface $tableData)
 {
     $this->_productIndexerHelper = $productIndexerHelper;
     $this->_connection = $resource->getConnection();
     $this->_config = $config;
     $this->_storeManager = $storeManager;
     $this->_tableData = $tableData;
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:15,代码来源:FlatTableBuilder.php


示例13: setUp

 protected function setUp()
 {
     $connectionMock = $this->getMockBuilder('\\Magento\\Framework\\DB\\Adapter\\AdapterInterface')->getMock();
     $this->resource = $this->getMock('Magento\\Framework\\App\\ResourceConnection', [], [], '', false);
     $this->resource->expects($this->any())->method('getConnection')->will($this->returnValue($connectionMock));
     $this->relation = $this->getMock('Magento\\Catalog\\Model\\ResourceModel\\Product\\Relation', [], [], '', false);
     $this->objectManagerHelper = new ObjectManagerHelper($this);
     $this->configurable = $this->objectManagerHelper->getObject('Magento\\ConfigurableProduct\\Model\\ResourceModel\\Product\\Type\\Configurable', ['resource' => $this->resource, 'catalogProductRelation' => $this->relation]);
 }
开发者ID:tingyeeh,项目名称:magento2,代码行数:9,代码来源:ConfigurableTest.php


示例14: setUp

 public function setUp()
 {
     $this->connectionMock = $this->getMock('Magento\\Framework\\DB\\Adapter\\Pdo\\Mysql', [], [], '', false);
     $this->resourceMock = $this->getMock('Magento\\Framework\\App\\ResourceConnection', [], [], '', false);
     $this->resourceMock->expects($this->any())->method('getConnection')->willReturn($this->connectionMock);
     $contextMock = $this->getMock('\\Magento\\Framework\\Model\\ModelResource\\Db\\Context', [], [], '', false);
     $contextMock->expects($this->once())->method('getResources')->willReturn($this->resourceMock);
     $this->tokenResource = new \Magento\Integration\Model\ResourceModel\Oauth\Token($contextMock, new \Magento\Framework\Stdlib\DateTime());
 }
开发者ID:whoople,项目名称:magento2-testing,代码行数:9,代码来源:TokenTest.php


示例15: setUp

 /**
  * Initialization
  */
 protected function setUp()
 {
     $this->connectionMock = $this->getMock('Magento\\Framework\\DB\\Adapter\\Pdo\\Mysql', [], [], '', false);
     $this->appResourceMock = $this->getMock('Magento\\Framework\\App\\ResourceConnection', [], [], '', false);
     $this->appResourceMock->expects($this->any())->method('getConnection')->will($this->returnValue($this->connectionMock));
     $this->appResourceMock->expects($this->any())->method('getTableName')->willReturnArgument(0);
     $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
     $this->taxItem = $objectManager->getObject('Magento\\Sales\\Model\\ResourceModel\\Order\\Tax\\Item', ['resource' => $this->appResourceMock]);
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:12,代码来源:ItemTest.php


示例16: __construct

 /**
  * @param ResourceConnection $resource
  * @param Range $range
  * @param Session $customerSession
  * @param MysqlDataProviderInterface $dataProvider
  * @param IntervalFactory $intervalFactory
  */
 public function __construct(ResourceConnection $resource, Range $range, Session $customerSession, MysqlDataProviderInterface $dataProvider, IntervalFactory $intervalFactory)
 {
     $this->resource = $resource;
     $this->connection = $resource->getConnection();
     $this->range = $range;
     $this->customerSession = $customerSession;
     $this->dataProvider = $dataProvider;
     $this->intervalFactory = $intervalFactory;
 }
开发者ID:whoople,项目名称:magento2-testing,代码行数:16,代码来源:DataProvider.php


示例17: setUp

 protected function setUp()
 {
     $this->config = $this->getMock('Magento\\Eav\\Model\\Config', [], [], '', false);
     $this->select = $this->getMockBuilder('Magento\\Framework\\DB\\Select')->setMethods(['select', 'from', 'where', 'join'])->disableOriginalConstructor()->getMock();
     $this->connection = $this->getMockBuilder('Magento\\Framework\\DB\\Adapter\\AdapterInterface')->disableOriginalConstructor()->getMockForAbstractClass();
     $this->resource = $this->getMock('Magento\\Framework\\App\\ResourceConnection', [], [], '', false);
     $this->resource->expects($this->any())->method('getConnection')->willReturn($this->connection);
     $this->storeViewService = (new ObjectManager($this))->getObject('Magento\\CatalogUrlRewrite\\Service\\V1\\StoreViewService', ['eavConfig' => $this->config, 'resource' => $this->resource]);
 }
开发者ID:koliaGI,项目名称:magento2,代码行数:9,代码来源:StoreViewServiceTest.php


示例18: 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


示例19: 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


示例20: getConnection

 /**
  * @return \Magento\Framework\DB\Adapter\AdapterInterface
  */
 protected function getConnection()
 {
     if (!$this->connection) {
         $this->connection = $this->resource->getConnection('sales');
     }
     return $this->connection;
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:10,代码来源:Attribute.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP App\ResponseInterface类代码示例发布时间:2022-05-23
下一篇:
PHP App\Resource类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap