Advertisement
Guest User

mase_wk

a guest
Jan 9th, 2014
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.77 KB | None | 0 0
  1. $object = [
  2.    'svc' => [
  3.     'msisdn' => '10234123413',
  4.         'serial' => '213-234-233'
  5.     ],
  6.     'email' => 'foo@example.com'
  7. ];
  8.  
  9. // get the rule collection from dicontainer
  10. $filter = $container->get('RuleCollection');
  11.  
  12. $filter->addSoftRule('email', Filter::IS_NOT, 'blank');
  13. $filter->addSoftRule('email', Filter::IS_NOT, 'valid_email');
  14.  
  15. $success = $filter->values($object);
  16. // all works ok, but I would like to apply a set of rules to the 'svc' property
  17.  
  18. $filter->addSoftRule('svc[msisdn]', Filter::IS_NOT, 'blank');
  19. $filter->addSoftRule('svc[serial]', Filter::IS_NOT, 'blank');
  20.  
  21. Obviously svc[msisdn] is not valid, but I was wondering if there is a pre-defined / recommended
  22. 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