example:
$example = new Model();
$example->name = 'abc';
$example->save();
How can I judge the results of ORM? Like this?
if($example->save){
...//do someting
}else{
...//do someting
}
But,I think it's wrong.Because,$example->save()
will return an object。So,theelse{}
can't run forever.How can I judge the results of ORM?
Thanks for everyone.
if($example)
,the $example should be a boolean. In ORM ,save()
will return an obj.Can I check the result like this:if($example->save()){}else{}
. – SoulKeep May 23 '16 at 07:30