开发者

Determining if saving a model is successful in Symfony

开发者 https://www.devze.com 2023-03-20 07:01 出处:网络
How will I determine if a new model was successfully save in symfony? I checked the return value of a model. For example $r开发者_运维知识库et = $model->save(); but $ret returns null. Usually, an exce

How will I determine if a new model was successfully save in symfony? I checked the return value of a model. For example $r开发者_运维知识库et = $model->save(); but $ret returns null.


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...


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

0

精彩评论

暂无评论...
验证码 换一张
取 消