Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
How to force update record?
  • When I updated the children records in relatated one-to-many tables and call $parent->save(true) I want that parent record was updated too. But it was not changed and not updated. Can I force updating of this record in any way?

    Thank you.
  • PS: I need it to force created_at field be changed by observer.
  • Harro VertonHarro Verton
    Accepted Answer
    The createdat observer will only be called on an INSERT, never on an update.

    The updatedat observer is called on every UPDATE, and will also update the updated_at column is a related and loaded child record has changed. This only works if the client object itself isn't saved first, as it will call is_changed() on all related objects, and that returns false after a save().
  • Yes, thank you, Harro.

    I would mean updated_at...

    It seemed not updated even if children updated... I will test it more and more...
  • I found one elegant way to force update unchanged record!
    $some_model->updated_at = 0;
    :D

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion