Welcome Guest, Not a member yet? Register   Sign In
How to skip no data to update exception?
#1

Hi, 
is there a way to skip the "no data to update" exception?

I use this line to save:
PHP Code:
$model->save($entity); 

Often the entity is new, but sometimes the entity is known and not changed.

I need this behavior: If there is something changed the update, if not, continue (without firing an exception).
Reply
#2

try/catch.

v4.3.0 will have allowEmptyInserts() method.
Reply
#3

(10-26-2022, 04:25 AM)kenjis Wrote: try/catch.

v4.3.0 will have allowEmptyInserts() method.

Do you mean to leave the catch empty,  something like this?
PHP Code:
try{
  $model->save($entity);       
} catch (\Exception $e) {
    // LEAVE THIS EMTPY
}

//other stuff that will be processed even when an Exception is fired. 
Reply




Theme © iAndrew 2016 - Forum software by © MyBB