Open nathggns opened 11 years ago
Only the model contains a schema definition and should perform type casting (modifiers, validators etc.) I'm not sure about the driver level. The driver however should only perform the queries requested, and not any more. Thus it can't know anything about the database schema and should not perform any operations based on that.
Oh I had forgotten about that. How about at the model level? It certainly has information about the schema and it's types.
Maybe even ignore schema types, just test for numeric values and typecast them that way?
The developer will know what type he wants to use. I'm a bit fed up with frameworks trying to prevent every possible mistake. It's what makes PHP so terrible to use. Just fail early and fail hard. The DBMS already does typecasting anyway. We should only do it on model level, together with validation.
Okay, cool. We'll do that then. I assume it should be done in ModelDatabase::value
(ModelDatabase::__get
), which ModelDatabase::export
uses anyway.
For example, should
id
always be converted to anint
?