taxjar / taxjar-magento2-extension

Magento 2 Sales Tax Extension by TaxJar
http://www.taxjar.com/guides/integrations/magento2/
Open Software License 3.0
22 stars 29 forks source link

Undefined $logger property in CustomerRepository plugin #353

Open lfolco opened 1 year ago

lfolco commented 1 year ago

Prerequisites

Description

Getting a "warning, undefined property" when trying to delete a customer. Culprit is the $logger property here: https://github.com/taxjar/taxjar-magento2-extension/blob/develop/Plugin/Customer/Model/ResourceModel/CustomerRepository.php#L41

Steps to Reproduce

  1. Try to delete a customer

Expected Result

Customer deleted

Actual Result

Error about missing property.

Versions

duncan16101994 commented 1 year ago

Hi All Any updates?

avstaylime commented 11 months ago

Hi All Any updates?

We implemented this patch to temporarily fix the problem.

diff --git a/vendor/taxjar/module-taxjar/Plugin/Customer/Model/ResourceModel/CustomerRepository.php b/vendor/taxjar/module-taxjar/Plugin/Customer/Model/ResourceModel/CustomerRepository.php
--- a/vendor/taxjar/module-taxjar/Plugin/Customer/Model/ResourceModel/CustomerRepository.php
+++ b/vendor/taxjar/module-taxjar/Plugin/Customer/Model/ResourceModel/CustomerRepository.php    (date 1673461450000)
@@ -6,6 +6,7 @@
 use Magento\Framework\Exception\LocalizedException;
 use Taxjar\SalesTax\Model\Client;
 use Taxjar\SalesTax\Model\ClientFactory;
+use Taxjar\SalesTax\Model\Configuration as TaxjarConfig;

 class CustomerRepository
 {
@@ -14,12 +15,21 @@
      */
     private $clientFactory;

+    /**
+     * @var \Taxjar\SalesTax\Model\Logger
+     */
+    protected $logger;
+
     /**
      * @param ClientFactory $clientFactory
      */
-    public function __construct(ClientFactory $clientFactory)
+    public function __construct(
+        ClientFactory $clientFactory,
+        \Taxjar\SalesTax\Model\Logger $logger
+    )
     {
         $this->clientFactory = $clientFactory;
+        $this->logger = $logger->setFilename(TaxjarConfig::TAXJAR_CUSTOMER_LOG);
     }

     /**