Does opening an asset, pimcore.asset.preUpdate event get called?

Hi All,

Running into a problem like, when I open an asset, pimcore.asset.preUpdate event gets called and always that function executes. I’m not sure whether you guys have run into this problem.

Thanks in advance.
Karthikeyan B

Hi,
is this a real problem for you? What are you trying to do?

@Florian Yes, I was modifying the properties of the asset onpreUpdate and will upload the asset to s3. But now running into a problem like those are keep calling for each asset open.

@Karthi96 Do you want to limit the function call only to specific assets? If so: I do similar things for DataObjects

if (\Pimcore\Model\DataObject\Course::class === get_class($event->getObject())) {
    My course is here
} 

This will run/trigger the following codes only if the events object is a Course

In my usecase, it was applicable to all assets. Don’t know how to stop calling onpreUpdate event on opening an asset. :frowning_face:

Not sure about your use case, but you might need to narrow down your code to only perform your action with the right precondition(s). I only need my code to execute for courses. The postUpdate Event is called many times and will be skipped if my conditions are not met

@Florian yeah written the code with the conditions, but here on opening an asset also it’s making an onPreUpdate call and actually preUpdate also calling the same. I don’t want to make an action for two different triggers.

Is there any way where we can find the trigger is from this actual event?

Are you manipulating and saving the event? This might not be the best trigger for you to use. If you want to only send your content to s3 it might be better to use postUpdate

Any knew things regarding this issue?