I've got a MySQL table which contains a 'status' column of type tinyint(1). (Actually this is a boolean column, but as far as I know MySQL does not support this type and auto-converts it to tinyint(1).)
If I perform an ORM::factory('Model', $id) on this table and check 'status' I get: a) NULL, if there is no entry for $id b) or (depending on the value stored in this field)
I'd like to be able to use those three different possiblities as 3 different status options and therefore perform a strict comparison - but this is not possible because of b)'s datatype STRING.
I tried to set
protected $_table_columns = array(
'user_id' => array(
'data_type' => 'integer'
),
'status' => array(
'data_type' => 'boolean',
'default' => FALSE,
),
);
but this also doesn't work (and according to what I found so far only the keys matter).
So my question is: Do I really have to cast the value to boolean myself or is there any possibility to specify the data type for an auto-cast done by Kohana?
Thanks!
I find Kohanas documentation on how to define columns lacking, there are some things I picked up here and there
It is fairly easy to write your own auto-generated rules, the following function adds some extra stuff to Kohana ORM: