CoreShop icon indicating copy to clipboard operation
CoreShop copied to clipboard

Support class names whose name begins with lowercase letter

Open BlackbitDevs opened this issue 2 years ago • 2 comments

Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no

Steps to reproduce bug:

  1. Create class with lowercase first letter, e.g. product, extend \CoreShop\Component\Core\Model\Product
  2. Set up the custom class configuration like described in https://docs.coreshop.org/2.2.0/Development/Extending_Guide/Extend_CoreShop_DataObjects.html:
    core_shop_product:
        pimcore:
            product:
                classes:
                    model: 'Pimcore\Model\DataObject\Product'
    
  3. Go to "cart price rules", add new rule, add Products condition, click "Search" -> you see that the defined Product class is not preselected.

The other fixed thing is when you override a data object class and set core_shop_product.pimcore.product.classes.model to the overridden FQCN (e.g. \App\Model\DataObject\Product), then https://github.com/coreshop/CoreShop/blob/aff8053fcd566bc1462112550cda413c854013e8/src/CoreShop/Bundle/ResourceBundle/DependencyInjection/Compiler/StackClassesPass.php#L58 does not have any effect.

BlackbitDevs avatar Mar 10 '22 16:03 BlackbitDevs

@BlackbitNeueMedien I fixed tests for 2.2, can you rebase to latest 2.2?

dpfaffenbauer avatar Mar 24 '22 08:03 dpfaffenbauer

Have I missed something? I merged up-to-date 2.2 branch but it complains about missing database columns.

BlackbitDevs avatar Mar 24 '22 10:03 BlackbitDevs

The problem still exists, also in 3.0 - do you know why you closed it, @dpfaffenbauer ? Because https://github.com/coreshop/CoreShop/pull/1896#pullrequestreview-982714728 can be easily fixed.

BlackbitDevs avatar Oct 26 '22 09:10 BlackbitDevs

This is actually quite difficult to solve. Problem is that during Container build time the ClassDefinitions cannot be loaded cause some of them require the kernel to be booted. So to fix this, I load the tokens from the definition file and try to find the classname, feels a bit dirty to me honestly, you might wanna check: https://github.com/coreshop/CoreShop/pull/2097

dpfaffenbauer avatar Oct 27 '22 06:10 dpfaffenbauer