I’m not really sure if this is a bug or not, though I think it is:
I have a table in an SQLite DB with (among others) an integer field that is allowed to be null and its default value is also set to null. When I instantiate a model based on that table, the corresponding value is initialized as 0 instead of null. This gives me problems when I use CExistValidator, as blank values are allowed but a value of 0 is checked (and doesn’t exist in the primary table), and thus results in a validation error.
This does seem like a bug, since 0 and null are different values. I can’t fix this with CDefaultValueValidator since the value isn’t ‘’ or null. Before I start hacking with isNewRecord in the model constructor, is there a better way to fix this, either in the model or in the db?