Ticket Details
Array support in Validator
RFC Ticket (closed)
Defining in a model:
{{{
public $validations = array(
'field' => array('notEmpty'=>'Empty')
);
}}}
and using it with an array of strings (aimed at MongoDB usage):
{{{
$entity->field = array('foo', 'bar', '');
$entity->save();
}}}
does not work.
There are two issues in terms of operation:
1. Returning bool is now ambigious, most likely needs change
2. Needs to define if it is ok with 1 empty or if 1 mathcing is sufficient to pass
Possible definition:
{{{
'field' => array('notEmpty' => array('message' => 'Empty', 'threshold' => $int));
}}}
where
* threshold = 1 = one matching is sufficient.
* threshold = 0 = all must match
* threshold = -1 = one failing is ok
Updates
on 11.02.10
by Nervetattoo
(duplicate)
on 07.04.11
by daschl
- id was changed to 320
- number was changed to 183
- version was changed to lithium-0.9.5
- owner was changed to daschl
- type was changed to rfc
- status was changed to closed
- resolution was changed to duplicate
- priority was changed to low
- title was changed to Array support in Validator
- description was changed
- tags was changed to model, Validator