{"action":"created","issue":{"url":"https://api.github.com/repos/phalcon/cphalcon/issues/690","labels_url":"https://api.github.com/repos/phalcon/cphalcon/issues/690/labels{/name}","comments_url":"https://api.github.com/repos/phalcon/cphalcon/issues/690/comments","events_url":"https://api.github.com/repos/phalcon/cphalcon/issues/690/events","html_url":"https://github.com/phalcon/cphalcon/issues/690","id":15206575,"number":690,"title":"[NFR] Skip other validators if field is empty and optional","user":{"login":"Agent-J","id":941804,"avatar_url":"https://avatars.githubusercontent.com/u/941804?v=3","gravatar_id":"","url":"https://api.github.com/users/Agent-J","html_url":"https://github.com/Agent-J","followers_url":"https://api.github.com/users/Agent-J/followers","following_url":"https://api.github.com/users/Agent-J/following{/other_user}","gists_url":"https://api.github.com/users/Agent-J/gists{/gist_id}","starred_url":"https://api.github.com/users/Agent-J/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Agent-J/subscriptions","organizations_url":"https://api.github.com/users/Agent-J/orgs","repos_url":"https://api.github.com/users/Agent-J/repos","events_url":"https://api.github.com/users/Agent-J/events{/privacy}","received_events_url":"https://api.github.com/users/Agent-J/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/phalcon/cphalcon/labels/New+Feature+Request","name":"New Feature Request","color":"DDDDDD"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2013-06-06T05:27:39Z","updated_at":"2015-01-06T21:26:04Z","closed_at":null,"body":"If field is empty and 'required' validator is absent then other validators should be skipped.\r\nThis is a very common scenario: the field must either be empty or have a valid format.\r\n\r\n```php\r\nuse Phalcon\\Validation\\Validator\\PresenceOf,\r\n    Phalcon\\Validation\\Validator\\Email;\r\n\r\n$validation = new Phalcon\\Validation;\r\n$validation->add('email_1', new Email);\r\n$validation->add('email_2', new Email);\r\n$validation->add('email_2', new PresenceOf);\r\n\r\n// The validation should be passed if email_1 field is empty 'cause it optional\r\n```\r\n\r\n<bountysource-plugin>\r\n\r\n---\r\nWant to back this issue? **[Place a bounty on it!](https://www.bountysource.com/issues/1896336-nfr-skip-other-validators-if-field-is-empty-and-optional?utm_campaign=plugin&utm_content=tracker%2F50707&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F50707&utm_medium=issues&utm_source=github).\r\n</bountysource-plugin>"},"comment":{"url":"https://api.github.com/repos/phalcon/cphalcon/issues/comments/68936556","html_url":"https://github.com/phalcon/cphalcon/issues/690#issuecomment-68936556","issue_url":"https://api.github.com/repos/phalcon/cphalcon/issues/690","id":68936556,"user":{"login":"crocodile2u","id":1736820,"avatar_url":"https://avatars.githubusercontent.com/u/1736820?v=3","gravatar_id":"","url":"https://api.github.com/users/crocodile2u","html_url":"https://github.com/crocodile2u","followers_url":"https://api.github.com/users/crocodile2u/followers","following_url":"https://api.github.com/users/crocodile2u/following{/other_user}","gists_url":"https://api.github.com/users/crocodile2u/gists{/gist_id}","starred_url":"https://api.github.com/users/crocodile2u/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crocodile2u/subscriptions","organizations_url":"https://api.github.com/users/crocodile2u/orgs","repos_url":"https://api.github.com/users/crocodile2u/repos","events_url":"https://api.github.com/users/crocodile2u/events{/privacy}","received_events_url":"https://api.github.com/users/crocodile2u/received_events","type":"User","site_admin":false},"created_at":"2015-01-06T21:26:04Z","updated_at":"2015-01-06T21:26:04Z","body":"Wow, that's really-really nice to hear! Thanks for your work!"}}