Compare new values to old values in DataObjectEvent / onPreUpdate

I am listening to pimcore.dataobject.preUpdate events.

DataObjectEvent::getObject() contains the new Object. Is there a way to access the old object values, to be able to compare new to old?

Thank You!

Hi there,

in case someone else stumbles across this post here’s my solution:

ClassName::getById($event->getObject()->getId(), true);

The second parameter forces Pimcore to fetch the current state from the database.

1 Like

I think it might be safer to user the Version system.