Use real inheritance for pimcore product objects


#1

Hi all,

I’m currently trying to design a product database in pimcore with real inheritance not variants.
Example:
Class Parentproduct with field ean
— class ProductsWithSomeSameParams with fields material, height, width
------- class ProductA with fields field1, field2
------- class ProductB with fields field3

I try to create directly the concrete objects for ProductA123 where I want to fill in the fields field1, field2, material and ean like in a classic php inheritance.

In pimcore I only find the inheritance feature in the class editor with which I can create a main product with ean 123 and some child products - which is a variant feature in my opinion. This is not what I need. And I also don’t want to have all attributes in one class ProductA because for this I have the php inheritance possiblites. I tried also the object bricks but this has the disadvantage that the editor must remember which object bricks he has to add and do not forget one.

Is there a possiblity to use a real inheritance for pimcore objects?

Can this be achieved with the “php parent class” field in the class editor?
I tried to create two classes MainProduct and ProductsWithSomeSameParams and in the “parent php class” field in the ProductsWithSomeSameParams class I added the MainProduct path and in the MainProduct class “parent php class” field I added Pimcore\Model\DataObject\Concrete but then I have nevertheless only the fields of ProductsWithSomeSameParams in their object instance and not the parent class fields from MainProduct.

Would be great to get some hint if it possible and how.

Kind regards and thanks for any answer in advance

Sonja


#2

Nope, there isn’t. Inheritance only works within the same class.