With current validation I can't set all user posted data to the model without causing exception:
<?php
$car->set_values($_POST);
It possibly throws me something like this:
_[Kohana_BadDataException] Message: Unable to set the specified property. Reason: Value x failed to pass validation constraints.
I would like to validate the model only when I save/update it. And I would like to use the model as an object where get the user posted and other data from.
Get rid of current validation.
Make a validation for model.
Maybe the validation rules could get set for each Field, but anyway it should not get validated right when value gets set.
Also the validation should be as an separate function, because not always you need it.
Oh, and there should be a "error" variable, where to store the error message, so that I can get that error in my template:
With current validation I can't set all user posted data to the model without causing exception:
It possibly throws me something like this: _[Kohana_BadDataException] Message: Unable to set the specified property. Reason: Value x failed to pass validation constraints.
I would like to validate the model only when I save/update it. And I would like to use the model as an object where get the user posted and other data from.
Possible solutions
Get rid of current validation. Make a validation for model. Maybe the validation rules could get set for each Field, but anyway it should not get validated right when value gets set. Also the validation should be as an separate function, because not always you need it. Oh, and there should be a "error" variable, where to store the error message, so that I can get that error in my template: