How to modify data object set behavior (aka where are Data Object functions located?) #10805
Unanswered
brbintenyears
asked this question in
Q&A / Support
Replies: 2 comments
-
Check out the Asset Events, especially the public static function getSubscribedEvents(): array
{
return [
AssetEvents::POST_ADD => 'doStuffWithAsset',
];
}
public function doStuffWithAsset(Asset $asset) {} If you want to get it on events on the dataobject rather than asset, then DataObjectEvents are your friend. |
Beta Was this translation helpful? Give feedback.
0 replies
-
You can override the generated class and extend the functionality like explained here https://pimcore.com/docs/pimcore/current/Development_Documentation/Extending_Pimcore/Overriding_Models.html#page_Overriding-Models-Entities-in-Pimcore |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
For each created data object, there are getters and setters made. Let's say, getImage() and setImage().
I have a data object that contains an Image type. On upload, I would like to add an additional step to it (convert the image to webp format then store a path to that as well in the data object's entry in DB). I already have that function ready, I'm just not sure where to place it such that it is executed on saving a modification to an instance of the data object.
Beta Was this translation helpful? Give feedback.
All reactions