Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $object = [
- 'svc' => [
- 'msisdn' => '10234123413',
- 'serial' => '213-234-233'
- ],
- 'email' => 'foo@example.com'
- ];
- // get the rule collection from dicontainer
- $filter = $container->get('RuleCollection');
- $filter->addSoftRule('email', Filter::IS_NOT, 'blank');
- $filter->addSoftRule('email', Filter::IS_NOT, 'valid_email');
- $success = $filter->values($object);
- // all works ok, but I would like to apply a set of rules to the 'svc' property
- $filter->addSoftRule('svc[msisdn]', Filter::IS_NOT, 'blank');
- $filter->addSoftRule('svc[serial]', Filter::IS_NOT, 'blank');
- Obviously svc[msisdn] is not valid, but I was wondering if there is a pre-defined / recommended
- way of dealing with this situation. Or if I am supposed to create my own wrapper ?
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement