$user = new User();
$user->save();
$errors = $user->getErrors();// has data, $user->name can't be null
I’ve got some save code (more complicated than above) that is generating an error. If I don’t want it to be suppressed any way that I can have it automatically throw the correct CDbException, or how do I turn the getErrors call into a CDbException?
Just a suggestion for your consideration - Why would you want to save “empty” data? Maybe you can set some error checking at the MVC’s View. Only if the form is correctly fill-up will then save into the database.
Do correct me if I have misinterpret your question.
I wasn’t really saving empty information, just giving a summary.
Really I was doing something like:
new User()
set a bunch of properties
save()
One of the columns on User was set as Not NULL in the database (mysql) but instead of throwing an exception it doesn’t insert into the db and puts the error in the getErrors() call.