Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undefined $logger property in CustomerRepository plugin #353

Open
6 of 11 tasks
lfolco opened this issue Feb 2, 2023 · 2 comments · May be fixed by #355
Open
6 of 11 tasks

Undefined $logger property in CustomerRepository plugin #353

lfolco opened this issue Feb 2, 2023 · 2 comments · May be fixed by #355

Comments

@lfolco
Copy link

lfolco commented Feb 2, 2023

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

  • Magento 2.4
  • Magento 2.3
  • Magento Open Source (fka Magento 2 Community Edition)
  • Adobe Commerce (fka Magento 2 Enterprise Edition)
  • PHP 8.2
  • PHP 8.1
  • PHP 7.4
  • PHP 7.3
@duncan16101994
Copy link

Hi All
Any updates?

@avstaylime
Copy link

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);
     }

     /**

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants