{"action":"created","issue":{"url":"https://api.github.com/repos/zendframework/zend-inputfilter/issues/62","labels_url":"https://api.github.com/repos/zendframework/zend-inputfilter/issues/62/labels{/name}","comments_url":"https://api.github.com/repos/zendframework/zend-inputfilter/issues/62/comments","events_url":"https://api.github.com/repos/zendframework/zend-inputfilter/issues/62/events","html_url":"https://github.com/zendframework/zend-inputfilter/pull/62","id":104783883,"number":62,"title":"Feature/required validator","user":{"login":"Maks3w","id":1301698,"avatar_url":"https://avatars.githubusercontent.com/u/1301698?v=3","gravatar_id":"","url":"https://api.github.com/users/Maks3w","html_url":"https://github.com/Maks3w","followers_url":"https://api.github.com/users/Maks3w/followers","following_url":"https://api.github.com/users/Maks3w/following{/other_user}","gists_url":"https://api.github.com/users/Maks3w/gists{/gist_id}","starred_url":"https://api.github.com/users/Maks3w/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Maks3w/subscriptions","organizations_url":"https://api.github.com/users/Maks3w/orgs","repos_url":"https://api.github.com/users/Maks3w/repos","events_url":"https://api.github.com/users/Maks3w/events{/privacy}","received_events_url":"https://api.github.com/users/Maks3w/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/zendframework/zend-inputfilter/milestones/5","html_url":"https://github.com/zendframework/zend-inputfilter/milestones/2.6.0","labels_url":"https://api.github.com/repos/zendframework/zend-inputfilter/milestones/5/labels","id":1148985,"number":5,"title":"2.6.0","description":"next feature release","creator":{"login":"Maks3w","id":1301698,"avatar_url":"https://avatars.githubusercontent.com/u/1301698?v=3","gravatar_id":"","url":"https://api.github.com/users/Maks3w","html_url":"https://github.com/Maks3w","followers_url":"https://api.github.com/users/Maks3w/followers","following_url":"https://api.github.com/users/Maks3w/following{/other_user}","gists_url":"https://api.github.com/users/Maks3w/gists{/gist_id}","starred_url":"https://api.github.com/users/Maks3w/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Maks3w/subscriptions","organizations_url":"https://api.github.com/users/Maks3w/orgs","repos_url":"https://api.github.com/users/Maks3w/repos","events_url":"https://api.github.com/users/Maks3w/events{/privacy}","received_events_url":"https://api.github.com/users/Maks3w/received_events","type":"User","site_admin":false},"open_issues":1,"closed_issues":0,"state":"open","created_at":"2015-06-04T07:32:43Z","updated_at":"2015-09-03T22:13:36Z","due_on":null,"closed_at":null},"comments":6,"created_at":"2015-09-03T21:17:19Z","updated_at":"2015-10-10T10:28:06Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/zendframework/zend-inputfilter/pulls/62","html_url":"https://github.com/zendframework/zend-inputfilter/pull/62","diff_url":"https://github.com/zendframework/zend-inputfilter/pull/62.diff","patch_url":"https://github.com/zendframework/zend-inputfilter/pull/62.patch"},"body":"These allows manage the required message like any other ValidatorInterface element.\r\n\r\nNote: While you can add the validator manually the flag `setRequired` must be set too\r\n\r\n```php\r\n  $input = new Input();\r\n  $input->setRequired(true);empty value instead *not set*.\r\n  $input->getValidatorChain()->attach(\r\n      new Zend\\InputFilter\\Validator\\Required(),\r\n      true                             // break chain on failure\r\n\r\n  );\r\n  ```\r\n\r\n  ```php\r\n  $inputSpecification = [\r\n    'required'   => true,\r\n    'validators' => [\r\n      [\r\n        'break_chain_on_failure' => true,\r\n        'name'                   => 'Zend\\\\InputFilter\\\\Validator\\\\Required',\r\n      ],\r\n    ],\r\n  ];\r\n  ```\r\n\r\nNote: `setRequired(false)` may not be enough and you will need remove the validator from the chain."},"comment":{"url":"https://api.github.com/repos/zendframework/zend-inputfilter/issues/comments/147071844","html_url":"https://github.com/zendframework/zend-inputfilter/pull/62#issuecomment-147071844","issue_url":"https://api.github.com/repos/zendframework/zend-inputfilter/issues/62","id":147071844,"user":{"login":"Maks3w","id":1301698,"avatar_url":"https://avatars.githubusercontent.com/u/1301698?v=3","gravatar_id":"","url":"https://api.github.com/users/Maks3w","html_url":"https://github.com/Maks3w","followers_url":"https://api.github.com/users/Maks3w/followers","following_url":"https://api.github.com/users/Maks3w/following{/other_user}","gists_url":"https://api.github.com/users/Maks3w/gists{/gist_id}","starred_url":"https://api.github.com/users/Maks3w/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Maks3w/subscriptions","organizations_url":"https://api.github.com/users/Maks3w/orgs","repos_url":"https://api.github.com/users/Maks3w/repos","events_url":"https://api.github.com/users/Maks3w/events{/privacy}","received_events_url":"https://api.github.com/users/Maks3w/received_events","type":"User","site_admin":false},"created_at":"2015-10-10T10:28:06Z","updated_at":"2015-10-10T10:28:06Z","body":"Also rely on $context makes the input dependant of InputFilter implementation and can't be used standalone."}}