magento-2-blog icon indicating copy to clipboard operation
magento-2-blog copied to clipboard

Magento 2.4.4 installation fails with module

Open BorisovskiP opened this issue 3 years ago • 5 comments

When installing Magento 2.4.4 with bin/magento setup:install the installation fails with

[Progress: 351 / 1431]
Module 'Mageplaza_Core':
[Progress: 352 / 1431]
Module 'Mageplaza_Blog':

In Config.php line 449:

  [Magento\Framework\Exception\LocalizedException]
  Invalid entity_type specified: customer


Exception trace:
  at /var/www/html/vendor/magento/module-eav/Model/Config.php:449
 Magento\Eav\Model\Config->getEntityType() at /var/www/html/vendor/magento/module-eav/Model/Entity/AbstractEntity.php:326
 Magento\Eav\Model\Entity\AbstractEntity->setType() at /var/www/html/dev/tests/integration/tmp/sandbox-0-f7ad8f84d33a12987aec437e3b27367635fd589fd3258c86d79fdaef59f41def/generated/code/Magento/Customer/Model/ResourceModel/Customer/Interceptor.php:149
 Magento\Customer\Model\ResourceModel\Customer\Interceptor->setType() at /var/www/html/vendor/magento/module-customer/Model/ResourceModel/Customer.php:97
 Magento\Customer\Model\ResourceModel\Customer->__construct() at /var/www/html/dev/tests/integration/tmp/sandbox-0-f7ad8f84d33a12987aec437e3b27367635fd589fd3258c86d79fdaef59f41def/generated/code/Magento/Customer/Model/ResourceModel/Customer/Interceptor.php:14
 Magento\Customer\Model\ResourceModel\Customer\Interceptor->__construct() at /var/www/html/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:121

The same error can be reproduces when running integration tests.

Tested on Magento 2.4.4, PHP 8.1, Mageplaza_Blog 4.1.3.

The same error message is also thrown in https://github.com/mageplaza/magento-2-smtp/issues/309

BorisovskiP avatar May 10 '22 13:05 BorisovskiP

I managed to upgrade to 2.4.4 with PHP 8.1, but during first compilation, I get this error;

PHP Fatal error:  Cannot use Magento\Tests\NamingConvention\true\mixed as mixed because 'mixed' is a special class name in /opt/magento/public_html/vendor/mageplaza/magento-2-blog-extension/Model/ResourceModel/Category/Collection.php on line 28
{"messages":{"error":[{"code":500,"message":"Server internal error. See details in report api\/1346736609828"}]}}

I'm pretty sure PHP8.* isn't supported (yet).

Asitis avatar May 13 '22 10:05 Asitis

@Asitis we also got that error, but we wanted to test the module anyway by removing the dependency from the class itself and got the error mentioned above.

BorisovskiP avatar May 13 '22 11:05 BorisovskiP

Removing CustomerResource from dependencies resolves the issue:

diff --git a/vendor/mageplaza/module-smtp/Setup/UpgradeSchema.php b/vendor/mageplaza/module-smtp/Setup/UpgradeSchema.php
index 52e63ee..13a1bd9 100644
--- a/vendor/mageplaza/module-smtp/Setup/UpgradeSchema.php
+++ b/vendor/mageplaza/module-smtp/Setup/UpgradeSchema.php
@@ -27,7 +27,6 @@ use Magento\Framework\Setup\SchemaSetupInterface;
 use Magento\Framework\Setup\UpgradeSchemaInterface;
 use Magento\Quote\Model\ResourceModel\Quote as QuoteResource;
 use Magento\Sales\Model\ResourceModel\Order as OrderResource;
-use Magento\Customer\Model\ResourceModel\Customer as CustomerResource;
 use Magento\Newsletter\Model\ResourceModel\Subscriber as SubscriberResource;
 use Zend_Db_Exception;

@@ -47,11 +46,6 @@ class UpgradeSchema implements UpgradeSchemaInterface
      */
     protected $orderResource;

-    /**
-     * @var CustomerResource
-     */
-    protected $customerResource;
-
     /**
      * @var SubscriberResource
      */
@@ -62,18 +56,15 @@ class UpgradeSchema implements UpgradeSchemaInterface
      *
      * @param QuoteResource $quoteResource
      * @param OrderResource $orderResource
-     * @param CustomerResource $customerResource
      * @param SubscriberResource $subscriberResource
      */
     public function __construct(
         QuoteResource $quoteResource,
         OrderResource $orderResource,
-        CustomerResource $customerResource,
         SubscriberResource $subscriberResource
     ) {
         $this->quoteResource      = $quoteResource;
         $this->orderResource      = $orderResource;
-        $this->customerResource   = $customerResource;
         $this->subscriberResource = $subscriberResource;
     }

@@ -227,8 +218,7 @@ class UpgradeSchema implements UpgradeSchemaInterface
                 'comment'  => 'Mp SMTP Email Marketing synced'
             ];

-            $customerConnection = $this->customerResource->getConnection();
-            $customerConnection->addColumn(
+            $connection->addColumn(
                 $setup->getTable('customer_entity'),
                 'mp_smtp_email_marketing_synced',
                 $column

vasylmalanka avatar May 30 '22 10:05 vasylmalanka

Doesn't work for Mageplaza_Blog

jeros-tbd avatar Jun 24 '22 13:06 jeros-tbd

resolved with session proxy into di.xml of Mageplaza_Blog module :

    <type name="Mageplaza\Blog\Helper\Data">
        <arguments>
            <argument name="customerSession" xsi:type="object">Magento\Customer\Model\Session\Proxy</argument>
        </arguments>
    </type>

jeros-tbd avatar Jun 24 '22 14:06 jeros-tbd