Esempio n. 1
0
 /**
  * @param string $sourceDocument
  * @return \Magento\Framework\DB\Select
  */
 protected function getConfigurablePrice($sourceDocument)
 {
     $sourceDocumentName = $this->source->addDocumentPrefix($sourceDocument);
     $fields = ['store_id' => 'website_id', 'value' => 'pricing_value', 'entity_id' => 'l.product_id', 'attribute_id' => 'cpsa.attribute_id'];
     /** @var \Magento\Framework\DB\Select $select */
     $select = $this->sourceAdapter->getSelect();
     $select->from($sourceDocumentName, $fields)->joinInner(['cpsa' => $this->source->addDocumentPrefix('catalog_product_super_attribute')], 'cpsa.product_super_attribute_id = ' . $sourceDocumentName . '.product_super_attribute_id', [])->joinInner(['l' => $this->source->addDocumentPrefix('catalog_product_super_link')], 'cpsa.product_id = l.parent_id', [])->joinInner(['a' => $this->source->addDocumentPrefix('catalog_product_super_attribute')], 'l.parent_id = a.product_id', [])->joinInner(['cp' => $this->source->addDocumentPrefix('catalog_product_entity_int')], 'l.product_id = cp.entity_id AND cp.attribute_id = a.attribute_id AND cp.store_id = ' . $sourceDocumentName . '.website_id', [])->joinInner(['apd' => $this->source->addDocumentPrefix('catalog_product_super_attribute_pricing')], 'a.product_super_attribute_id = apd.product_super_attribute_id AND apd.pricing_value = ' . $sourceDocumentName . '.pricing_value AND cp.value = apd.value_index', [])->joinInner(['le' => $this->source->addDocumentPrefix('catalog_product_entity')], 'le.entity_id = l.product_id', []);
     return $select;
 }
Esempio n. 2
0
 /**
  * @param array $columns
  * @param array $entityIds
  * @return \Magento\Framework\DB\Select
  */
 public function getSelectSalesCreditmemoGrid(array $columns, $entityIds = [])
 {
     foreach ($columns as $key => $value) {
         $columns[$key] = new \Zend_Db_Expr($value);
     }
     /** @var \Magento\Framework\DB\Select $select */
     $select = $this->destinationAdapter->getSelect();
     $select->from(['sales_creditmemo' => $this->destination->addDocumentPrefix('sales_creditmemo')], [])->joinLeft(['sales_order' => $this->destination->addDocumentPrefix('sales_order')], 'sales_creditmemo.order_id = sales_order.entity_id', [])->joinLeft(['sales_shipping_address' => $this->destination->addDocumentPrefix('sales_order_address')], 'sales_creditmemo.shipping_address_id = sales_shipping_address.entity_id', [])->joinLeft(['sales_billing_address' => $this->destination->addDocumentPrefix('sales_order_address')], 'sales_creditmemo.billing_address_id = sales_billing_address.entity_id', [])->where('sales_creditmemo.entity_id in (?)', $entityIds);
     $select->columns($columns);
     return $select;
 }
 public function testGetSelect()
 {
     $select = $this->getMock('\\Magento\\Framework\\DB\\Select', [], [], '', false);
     $this->pdoMysql->expects($this->any())->method('select')->willReturn($select);
     $this->assertSame($select, $this->adapterMysql->getSelect());
 }
 /**
  * Fulfill temporary table with redirects
  *
  * @param \Migration\Resource\Adapter\Mysql $adapter
  * @return void
  */
 protected function collectRedirects(\Migration\Resource\Adapter\Mysql $adapter)
 {
     $select = $adapter->getSelect();
     $select->from(['r' => $this->source->addDocumentPrefix('enterprise_url_rewrite')], ['id' => 'IFNULL(NULL, NULL)', 'request_path' => 'r.request_path', 'target_path' => 'r.target_path', 'is_system' => 'r.is_system', 'store_id' => "s.store_id", 'entity_type' => "trim('custom')", 'redirect_type' => "(SELECT CASE eurr.options WHEN 'RP' THEN 301 WHEN 'R' THEN 302 ELSE 0 END)", 'product_id' => "trim('0')", 'category_id' => "trim('0')", 'priority' => "trim('2')"]);
     $select->join(['eurrr' => $this->source->addDocumentPrefix('enterprise_url_rewrite_redirect_rewrite')], 'eurrr.url_rewrite_id = r.url_rewrite_id', []);
     $select->join(['eurr' => $this->source->addDocumentPrefix('enterprise_url_rewrite_redirect')], 'eurrr.redirect_id = eurr.redirect_id', []);
     $select->join(['s' => $this->source->addDocumentPrefix('core_store')], 's.store_id > 0', []);
     $query = $select->insertFromSelect($this->source->addDocumentPrefix($this->tableName));
     $select->getAdapter()->query($query);
 }