I am trying to recover the termes and conditions in my class but without success.
Here is my class :
class Bvr extends \Magento\Framework\Model\AbstractModel{
public function __construct(
\Magento\Framework\Filesystem $filesystem,
\Magento\CheckoutAgreements\Model\Agreement $agreement,
array $data = []
) {
$this->_rootDirectory = $filesystem->getDirectoryRead(DirectoryList::ROOT);
$this->agreement = $agreement;
// parent::__construct($data);
}
protected function printSlip($invoice, $order) {
$referenceNumber = $invoice->getOrder()->getIsrReferenceNumber();
$aCmsPage = $this->agreement->getContent();
}
}
I get this error :
Fatal error: Call to a member function getContent() on null in /var/www/magento21-test2/app/code/acme/BVR/Model/PDF/Bvr.php
Is that you know the solution to recover the terms and conditions? Thank you