nopoles613
New member
Hello, we have a custom plugin we've built that uses a Code Event Listener to listen for the event entity_post_save on XF\Entity\Option objects. The Event Listener uses a callback to trigger some checks and updates when certain settings in our plugin are changed. This all works as expected.
However, there are cases where we'd like to change the value of the Option entity from the event listener.
Our listener receives the XF\Entity\Option $entity, and I've tried a half dozen ways to override $entity's "option_value". The closest I got was this, which seems to cause an internal event loop and never returns or saves the desired value:
$entity->set('option_value', 'New Value Here', ['forceSet' => true]);
$entity->save();
What's the best way to override the Option value from a code listener?
Thank you
However, there are cases where we'd like to change the value of the Option entity from the event listener.
Our listener receives the XF\Entity\Option $entity, and I've tried a half dozen ways to override $entity's "option_value". The closest I got was this, which seems to cause an internal event loop and never returns or saves the desired value:
$entity->set('option_value', 'New Value Here', ['forceSet' => true]);
$entity->save();
What's the best way to override the Option value from a code listener?
Thank you