_registryManager = isset($data['registry']) ? $data['registry'] : $coreRegistry; $this->_agreementResource = $agreementResource; if (false === $this->_registryManager instanceof \Magento\Framework\Registry) { throw new \InvalidArgumentException('registry object has to be an instance of \Magento\Framework\Registry'); } } /** * Add billing agreement filter * * @param mixed $argument * @return mixed * @throws \DomainException */ public function update($argument) { $billingAgreement = $this->_registryManager->registry('current_billing_agreement'); if (!$billingAgreement) { throw new \DomainException('Undefined billing agreement object'); } $this->_agreementResource->addOrdersFilter($argument, $billingAgreement->getId()); return $argument; } }