Closed taai closed 11 years ago
When the field in model is set to be an enum string, the Kohana_BadData_Exception is being thrown. Kohana_BadData_Exception [ 0 ]: Message: Unable to set default value for field. Reason: Value failed to pass validation constraints.
I can't even do this:
<?php $car = new Model_Leap_Car();
It's because in DB_ORM_Field_String the value is set to empty string and in that way the validation get's called right away and in_array($value, $this->metadata['enum']) is being checked. https://github.com/spadefoot/kohana-orm-leap/blob/3.2/develop/classes/base/db/orm/field/string.php#L80
in_array($value, $this->metadata['enum'])
I haven't tried other field types, but it's possible that this bug exists in other field types too.
__construnct()
When the field in model is set to be an enum string, the Kohana_BadData_Exception is being thrown. Kohana_BadData_Exception [ 0 ]: Message: Unable to set default value for field. Reason: Value failed to pass validation constraints.
I can't even do this:
It's because in DB_ORM_Field_String the value is set to empty string and in that way the validation get's called right away and
in_array($value, $this->metadata['enum'])
is being checked. https://github.com/spadefoot/kohana-orm-leap/blob/3.2/develop/classes/base/db/orm/field/string.php#L80I haven't tried other field types, but it's possible that this bug exists in other field types too.
Possible solutions
__construnct()
, check if there is no enum set.