You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Inserts or updates a model instance. Returning true on success or false otherwise.
...
$result = $invoice->save();
However, PDO's error reporting mode defaults to PDO::ERRMODE_EXCEPTION since PHP8, and I don't think Phalcon can be set otherwise.
Then, won't an exception be thrown when saving fails?
Can anyone give me a concrete example?
If an exception is thrown, isn't it pointless to receive the return value like this?
Similarly, what about create()?
Inserts a model in the database.If the record exists in the database, create() will throw an exception. It will return true on success, false otherwise.
...
$result = $invoice->create();
It is specified that an exception may be thrown (when the unique constraint is violated?), but what if false is returned without an exception being thrown?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
The documentation says:
However, PDO's error reporting mode defaults to
PDO::ERRMODE_EXCEPTION
since PHP8, and I don't think Phalcon can be set otherwise.Then, won't an exception be thrown when saving fails?
Can anyone give me a concrete example?
If an exception is thrown, isn't it pointless to receive the return value like this?
Similarly, what about create()?
It is specified that an exception may be thrown (when the unique constraint is violated?), but what if
false
is returned without an exception being thrown?Also, what about update()?
Beta Was this translation helpful? Give feedback.
All reactions