XF 2.0 DataWriter importMode equivalent for Entity Save

Sadik B

Well-known member
Hi,

In XF1, we could set the importMode to true for a dataWriter if we did not want the preSave and postSave functions to run. What would be the equivalent in XF2 if I just want to call save() on an entity and avoid the presave and postsave checks?
 
As far as I can tell, there is no way to avoid the entity life-cycle events from firing. Consider doing plain database inserts/updates instead?

If it's an existing entity, you can do:
PHP:
$entity->fastUpdate([
    'column'  => 'value',
    'column2' => 'value2'
]);
 
Last edited:
Yes I ended up doing plain db insert. But that's not a very good solution. Perhaps when XF2 builds their own importers, we will see a switch to disable the entity events.
 
Yes I ended up doing plain db insert. But that's not a very good solution. Perhaps when XF2 builds their own importers, we will see a switch to disable the entity events.
XF2 already has importers, they use entity emulator objects instead of actual entities. They're specialized to the import system though so I don't really think they're usable outside of it.
 
Top Bottom