shoppingflux / module-magento2

10 stars 9 forks source link

Unable to execute setup:install with shippingfeed module enabled #80

Closed syno-rdo closed 4 years ago

syno-rdo commented 4 years ago

Good afternoon,

Since we installed shoppingfeed/magento2-manager:0.39.0 we are unable to execute a setup:install on both our local and CI environments.

Instead we get this error message:

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'flag' doesn't exist, query was: SELECT flag.* FROM flag WHERE (flag.flag_code='staging')

The issue seems to be related with the module console commands. By commenting this portion of code, i was able to install the project.

<type name="Magento\Framework\Console\CommandList">
    <arguments>
        <argument name="commands" xsi:type="array">
            <item name="sfm_feed_sync_product_list" xsi:type="object">ShoppingFeed\Manager\Console\Command\Feed\SyncProductListCommand</item>
            <item name="sfm_feed_force_export_state_refresh" xsi:type="object">ShoppingFeed\Manager\Console\Command\Feed\ForceExportStateRefreshCommand</item>
            <item name="sfm_feed_force_sections_refresh" xsi:type="object">ShoppingFeed\Manager\Console\Command\Feed\ForceSectionsRefreshCommand</item>
            <item name="sfm_feed_force_automatic_refresh" xsi:type="object">ShoppingFeed\Manager\Console\Command\Feed\ForceAutomaticRefreshCommand</item>
            <item name="sfm_feed_refresh" xsi:type="object">ShoppingFeed\Manager\Console\Command\Feed\RefreshCommand</item>
            <item name="sfm_feed_export" xsi:type="object">ShoppingFeed\Manager\Console\Command\Feed\ExportCommand</item>
            <item name="sfm_orders_fetch_marketplace_orders" xsi:type="object">ShoppingFeed\Manager\Console\Command\Orders\FetchMarketplaceOrdersCommand</item>
            <item name="sfm_orders_import_sales_orders" xsi:type="object">ShoppingFeed\Manager\Console\Command\Orders\ImportSalesOrdersCommand</item>
            <item name="sfm_orders_send_state_updates" xsi:type="object">ShoppingFeed\Manager\Console\Command\Orders\SendStateUpdatesCommand</item>
        </argument>
    </arguments>
</type>

Please find below the informations about our stack.

Magento 2.3.5-p1 Entreprise Edition shoppingfeed/magento2-manager:0.39.0 php7.3.15

I remain at your disposal.

Best Regards,

R.D

blmage commented 4 years ago

Thanks for the detailed report, we'll investigate this asap!

blmage commented 4 years ago

We couldn't reproduce the problem yet on different M2 versions, but since your report points to the console commands, could you try adding this line:

<argument name="creditmemoFactory" xsi:type="object">Magento\Sales\Model\Order\CreditmemoFactory\Proxy</argument>

just after this one: https://github.com/shoppingflux/module-magento2/blob/24c37d9a50860c577edffa00e721d58f9533a266/etc/di.xml#L298 and report back whether you could install the new version?

syno-rdo commented 4 years ago

Hello @blmage

Thank you for your answer.

I added the line but the error still occurs.

I will take 20 minutes with a member of team and try to look deeper.

I remain at your disposal.

Best Regards

R.D

syno-rdo commented 4 years ago

@blmage

I was able to reproduce the issue on a fresh install of magento 2.3.5-p1

composer create-project --repository-url=https://repo.magento.com/ magento/project-enterprise-edition=2.3.5-p1 shopping-feed

COMPOSER_MEMORY_LIMIT=-1 composer require shoppingfeed/magento2-manager

bin/magento setup:install \
--base-url=http://localhost/magento2ee \
--db-host=localhost \
--db-name=shopping-feed \
--db-user=magento \
--db-password=magento \
--admin-firstname=admin \
--admin-lastname=admin \
--admin-email=admin@admin.com \
--admin-user=admin \
--admin-password=admin123 \
--language=en_US \
--currency=USD \
--timezone=America/Chicago \
--use-rewrites=1

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'shopping-feed.flag' doesn't exist, query was: SELECT flag.* FROM flag WHERE (flag.flag_code='staging')

For now, the workaround we use is listed below. The solution we provide may not be the best.

--- a/vendor/shoppingfeed/magento2-manager/etc/di.xml   2020-08-10 15:39:26.834461245 +0200
+++ b/vendor/shoppingfeed/magento2-manager/etc/di.xml   2020-08-10 15:11:10.298000000 +0200
@@ -70,12 +70,12 @@
     <type name="ShoppingFeed\Manager\Model\Feed\Product\Section\TypePool" shared="true">
         <arguments>
             <argument name="types" xsi:type="array">
-                <item name="stock" xsi:type="object">ShoppingFeed\Manager\Model\Feed\Product\Section\Type\Stock</item>
-                <item name="prices" xsi:type="object">ShoppingFeed\Manager\Model\Feed\Product\Section\Type\Prices</item>
-                <item name="attributes" xsi:type="object">ShoppingFeed\Manager\Model\Feed\Product\Section\Type\Attributes</item>
-                <item name="images" xsi:type="object">ShoppingFeed\Manager\Model\Feed\Product\Section\Type\Images</item>
-                <item name="categories" xsi:type="object">ShoppingFeed\Manager\Model\Feed\Product\Section\Type\Categories</item>
-                <item name="shipping" xsi:type="object">ShoppingFeed\Manager\Model\Feed\Product\Section\Type\Shipping</item>
+                <item name="stock" xsi:type="object">ShoppingFeed\Manager\Model\Feed\Product\Section\Type\Stock\Proxy</item>
+                <item name="prices" xsi:type="object">ShoppingFeed\Manager\Model\Feed\Product\Section\Type\Prices\Proxy</item>
+                <item name="attributes" xsi:type="object">ShoppingFeed\Manager\Model\Feed\Product\Section\Type\Attributes\Proxy</item>
+                <item name="images" xsi:type="object">ShoppingFeed\Manager\Model\Feed\Product\Section\Type\Images\Proxy</item>
+                <item name="categories" xsi:type="object">ShoppingFeed\Manager\Model\Feed\Product\Section\Type\Categories\Proxy</item>
+                <item name="shipping" xsi:type="object">ShoppingFeed\Manager\Model\Feed\Product\Section\Type\Shipping\Proxy</item>
             </argument>
         </arguments>
     </type>
--- a/vendor/shoppingfeed/magento2-manager/Model/Sales/Order/Importer.php   2020-08-10 15:31:11.587434531 +0200
+++ b/vendor/shoppingfeed/magento2-manager/Model/Sales/Order/Importer.php   2020-08-10 15:14:17.304000000 +0200
@@ -43,7 +43,7 @@
 use ShoppingFeed\Manager\Model\ResourceModel\Shipping\Method\Rule\CollectionFactory as ShippingMethodRuleCollectionFactory;
 use ShoppingFeed\Manager\Model\Sales\Order\Business\TaxManager as BusinessTaxManager;
 use ShoppingFeed\Manager\Model\Sales\Order\ConfigInterface as OrderConfigInterface;
-use ShoppingFeed\Manager\Model\Sales\Order\Customer\Importer as CustomerImporter;
+use ShoppingFeed\Manager\Model\Sales\Order\Customer\Importer\Proxy as CustomerImporter;
 use ShoppingFeed\Manager\Model\Shipping\Method\ApplierPoolInterface as ShippingMethodApplierPoolInterface;
 use ShoppingFeed\Manager\Model\TimeHelper;
 use ShoppingFeed\Manager\Model\Ui\Payment\ConfigProvider as PaymentConfigProvider;

I remain at your disposal.

Best Regards,

R.D

blmage commented 4 years ago

Looks good to me, thanks for your help in fixing this!

syno-rdo commented 4 years ago

you're welcome :) thanks you for your help