Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Agreement.php
Go to the documentation of this file.
1 <?php
7 
12 {
18  protected function _construct()
19  {
20  $this->_init('paypal_billing_agreement', 'agreement_id');
21  }
22 
30  public function addOrderRelation($agreementId, $orderId)
31  {
32  $this->getConnection()->insert(
33  $this->getTable('paypal_billing_agreement_order'),
34  ['agreement_id' => $agreementId, 'order_id' => $orderId]
35  );
36  return $this;
37  }
38 
46  public function addOrdersFilter(\Magento\Framework\Data\Collection\AbstractDb $orderCollection, $agreementIds)
47  {
48  $agreementIds = is_array($agreementIds) ? $agreementIds : [$agreementIds];
49  $orderIds = $this->getConnection()->fetchCol(
50  $this->getConnection()->select()
51  ->from(['pbao' => $this->getTable('paypal_billing_agreement_order')], ['order_id'])
52  ->where(
53  'pbao.agreement_id IN(?)',
54  $agreementIds
55  )
56  );
57  $orderCollection->getSelect()
58  ->where('main_table.entity_id IN (?)', $orderIds);
59  return $this;
60  }
61 }
$orderIds
Definition: results.phtml:9
addOrdersFilter(\Magento\Framework\Data\Collection\AbstractDb $orderCollection, $agreementIds)
Definition: Agreement.php:46