Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
OrdersUpdater.php
Go to the documentation of this file.
1 <?php
7 
11 class OrdersUpdater implements \Magento\Framework\View\Layout\Argument\UpdaterInterface
12 {
16  protected $_registryManager;
17 
22 
29  public function __construct(
30  \Magento\Framework\Registry $coreRegistry,
31  \Magento\Paypal\Model\ResourceModel\Billing\Agreement $agreementResource,
32  array $data = []
33  ) {
34  $this->_registryManager = isset($data['registry']) ? $data['registry'] : $coreRegistry;
35  $this->_agreementResource = $agreementResource;
36 
37  if (false === $this->_registryManager instanceof \Magento\Framework\Registry) {
38  throw new \InvalidArgumentException('registry object has to be an instance of \Magento\Framework\Registry');
39  }
40  }
41 
49  public function update($argument)
50  {
51  $billingAgreement = $this->_registryManager->registry('current_billing_agreement');
52 
53  if (!$billingAgreement) {
54  throw new \DomainException('Undefined billing agreement object');
55  }
56 
57  $this->_agreementResource->addOrdersFilter($argument, $billingAgreement->getId());
58  return $argument;
59  }
60 }
$billingAgreement
__construct(\Magento\Framework\Registry $coreRegistry, \Magento\Paypal\Model\ResourceModel\Billing\Agreement $agreementResource, array $data=[])