coreshop / CoreShop

CoreShop - Pimcore enhanced eCommerce
http://www.coreshop.org
Other
276 stars 157 forks source link

Symfony\Component\Debug\Exception\ClassNotFoundException on coreshop install #203

Closed Sighter closed 6 years ago

Sighter commented 6 years ago

Bug Report

Please answer the following questions

Expected behavior

Expected is an error free installation

Actual behavior

While installing coreshop on top of a clean pimcore install. The following error happens

Step 1 of 4. Install Pimcore Classes.                   
-------------------------------------                   

Install Resources for Environment dev.                                                                                                      
  1/18 [░]   5% Install Fieldcollection CoreShopProposalCartPriceRuleItem (/pimcore-install/vendor/coreshop/core-shop/src/CoreShop/Bundle/Ord
  2/18 [░]  11% Install Fieldcollection CoreShopTaxItem (/pimcore-install/vendor/coreshop/core-shop/src/CoreShop/Bundle/TaxationBundle/Resour
  3/18 [░]  16% Install Class CoreShopCart (/pimcore-install/vendor/coreshop/core-shop/src/CoreShop/Bundle/CoreBundle/Resources/install/pimco
  4/18 [░]  22% Install Class CoreShopCartItem (/pimcore-install/vendor/coreshop/core-shop/src/CoreShop/Bundle/CoreBundle/Resources/install/p
  5/18 [░]  27% Install Class CoreShopOrder (/pimcore-install/vendor/coreshop/core-shop/src/CoreShop/Bundle/CoreBundle/Resources/install/pimc
  6/18 [░]  33% Install Class CoreShopOrderShipment (/pimcore-install/vendor/coreshop/core-shop/src/CoreShop/Bundle/CoreBundle/Resources/inst
  7/18 [░]  38% Install Class CoreShopQuote (/pimcore-install/vendor/coreshop/core-shop/src/CoreShop/Bundle/CoreBundle/Resources/install/pimc
  8/18 [░]  44% Install Class CoreShopOrderItem (/pimcore-install/vendor/coreshop/core-shop/src/CoreShop/Bundle/OrderBundle/Resources/install
  9/18 [░]  50% Install Class CoreShopOrderInvoice (/pimcore-install/vendor/coreshop/core-shop/src/CoreShop/Bundle/OrderBundle/Resources/inst
 10/18 [░]  55% Install Class CoreShopOrderInvoiceItem (/pimcore-install/vendor/coreshop/core-shop/src/CoreShop/Bundle/OrderBundle/Resources/
 11/18 [░]  61% Install Class CoreShopOrderShipmentItem (/pimcore-install/vendor/coreshop/core-shop/src/CoreShop/Bundle/OrderBundle/Resources
 12/18 [░]  66% Install Class CoreShopQuoteItem (/pimcore-install/vendor/coreshop/core-shop/src/CoreShop/Bundle/OrderBundle/Resources/install
 13/18 [░]  72% Install Class CoreShopCustomerGroup (/pimcore-install/vendor/coreshop/core-shop/src/CoreShop/Bundle/CoreBundle/Resources/inst
 14/18 [░]  77% Install Class CoreShopCustomer (/pimcore-install/vendor/coreshop/core-shop/src/CoreShop/Bundle/CoreBundle/Resources/install/p
 15/18 [░]  83% Install Class CoreShopCategory (/pimcore-install/vendor/coreshop/core-shop/src/CoreShop/Bundle/CoreBundle/Resources/install/p
 16/18 [░]  88% Install Class CoreShopProduct (/pimcore-install/vendor/coreshop/core-shop/src/CoreShop/Bundle/CoreBundle/Resources/install/pi
 17/18 [░]  94% Install Class CoreShopManufacturer (/pimcore-install/vendor/coreshop/core-shop/src/CoreShop/Bundle/ProductBundle/Resources/in
 18/18 [░] 100% Install Class CoreShopAddress (/pimcore-install/vendor/coreshop/core-shop/src/CoreShop/Bundle/AddressBundle/Resources/install
 18/18 [░] 100% Install Class CoreShopAddress (/pimcore-install/vendor/coreshop/core-shop/src/CoreShop/Bundle/AddressBundle/Resources/install
 22/22 [░░░░░░░░░░░░░░░░░░░░░░░░░░░░] 100% Install Permission coreshop_permission_notification
Step 2 of 4. Setting up the database.
-------------------------------------

Creating CoreShop database for environment dev.
 2/2 [░░░░░░░░░░░░░░░░░░░░░░░░░░░░] 100%
 0/1 [░                           ]   0%

  [Symfony\Component\Debug\Exception\ClassNotFoundException]                          
  Attempted to load class "CoreShopOrder" from namespace "Pimcore\Model\DataObject".  
  Did you forget a "use" statement for "Pimcore\Model\DataObject\CoreShopOrder"?      

coreshop:fixture:data:load [--fixtures-type [FIXTURES-TYPE]] [--dry-run] [--bundles [BUNDLES]] [--exclude [EXCLUDE]] [-h|--help] [-q|--quiet]
 [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [--ignore-maintenance-mode] [--maintenance-mode] [-e|--env E
NV] [--no-debug] [--] <command>

Steps to reproduce

The error happens inside a docker setup. So navigate towards: https://github.com/Sighter/pimcore-docker clone the repo and checkout the coreshop-main branch. Then follow the instructions of the readme on the main branch.

dpfaffenbauer commented 6 years ago

The problem is that the Pimcore Data Object Classes are generated using the same "request/process". Therefore the autoloader is kinda stupid and doesn't find it, the solution is to forceLoad them after creation. Therefore I created a new Class called "ClassLoader" which takes care about force-loading these newly created classes:

https://github.com/coreshop/CoreShop/blob/376c073d6e10418c9f8130d634f9ee3b8355be0b/src/CoreShop/Component/Pimcore/ClassLoader.php

With that: I could run your docker configuration without any problems.