Search code examples
shopware6

How to add missing getters and setters to existing entity (#Shopware 6, #b2bsellers, #b2bsellers-suite)


I am tasked to make the B2Bsellers plugin work for our use case. I need to access data from EmployeePermissionTranslationEntity. The plugin has not defined a getter for the field i need to access.

I can see that the data exists though debugging, but the getter is not defined. How can I extend this entity and manually add the getter though my own plugin?


Solution

  • The \Shopware\Core\Framework\DataAbstractionLayer\Entity class defines a magic getter method https://github.com/shopware/platform/blob/v6.4.15.2/src/Core/Framework/DataAbstractionLayer/Entity.php#L44

    so you should have access to it with $employeePermissionTranslationEntity->propertyName