Mark Harold C. Rivera
Mark Harold C. Rivera

Reputation: 291

Determining if saving a model is successful in Symfony

How will I determine if a new model was successfully save in symfony? I checked the return value of a model. For example $ret = $model->save(); but $ret returns null.

Upvotes: 0

Views: 206

Answers (2)

melekes
melekes

Reputation: 1888

Usually, an exception (e.g. PropelException) will be thrown if something goes wrong. Text message will look like this: PropelException: Unable to execute UPDATE (ADD) statement...

Upvotes: 1

Andreu Ramos
Andreu Ramos

Reputation: 2908

you can query it after the save() method, and if the result is not empty save() has gone fine

Upvotes: 0

Related Questions