/**
  * @param array $columns
  * @param \Zend_Db_Expr|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;
 }
 /**
  * Fulfill temporary table with redirects
  *
  * @param \Migration\ResourceModel\Adapter\Mysql $adapter
  * @return void
  */
 protected function collectRedirects(\Migration\ResourceModel\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')", 'cms_page_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);
 }
 /**
  * @return string
  */
 protected function getPriceAttributeId()
 {
     $select = $this->sourceAdapter->getSelect();
     $select->from($this->source->addDocumentPrefix('eav_attribute'))->where('attribute_code = ?', 'price');
     return $select->getAdapter()->fetchOne($select);
 }
 /**
  * @return void
  */
 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());
 }