Lets say we have a model Model_Event with 2 fields: date_start and date_end.
The start-date of an event shouldn't be before the end-date. Now I am trying to implement a validation for this situation:
class Model_Event extends \Orm\Model {
protected static $_properties = array(
'date_start' => array(
'data_type' => 'string',
'label' => 'Start-Datum',
'validation' => array(
'date_start'
),
'form' => array( 'type' => 'date'),
),
'date_end' => array(
'data_type' => 'string',
'label' => 'End-Datum',
'validation' => array(
'date_start'
),
'form' => array('type' => 'date'),
),
);
public static function _validation_date_start($value) {
}
public static function_validation_date_end($value) {
}} The problem is, that in the _validation_date_end/_validation_date_start methods are static methods, so I have no access to the other value (and it wouldn't help since the other value could be modified as well). How can I write a validation for this situation?