{"action":"created","issue":{"url":"https://api.github.com/repos/Respect/Validation/issues/664","repository_url":"https://api.github.com/repos/Respect/Validation","labels_url":"https://api.github.com/repos/Respect/Validation/issues/664/labels{/name}","comments_url":"https://api.github.com/repos/Respect/Validation/issues/664/comments","events_url":"https://api.github.com/repos/Respect/Validation/issues/664/events","html_url":"https://github.com/Respect/Validation/issues/664","id":148557150,"number":664,"title":"Get error messages indexed by name","user":{"login":"batusa","id":5388003,"avatar_url":"https://avatars3.githubusercontent.com/u/5388003?v=4","gravatar_id":"","url":"https://api.github.com/users/batusa","html_url":"https://github.com/batusa","followers_url":"https://api.github.com/users/batusa/followers","following_url":"https://api.github.com/users/batusa/following{/other_user}","gists_url":"https://api.github.com/users/batusa/gists{/gist_id}","starred_url":"https://api.github.com/users/batusa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/batusa/subscriptions","organizations_url":"https://api.github.com/users/batusa/orgs","repos_url":"https://api.github.com/users/batusa/repos","events_url":"https://api.github.com/users/batusa/events{/privacy}","received_events_url":"https://api.github.com/users/batusa/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-04-15T05:21:07Z","updated_at":"2018-02-11T21:16:26Z","closed_at":null,"author_association":"MEMBER","body":"taking a similar example from #649 :\n\n``` php\ntry {\n    v::key('activity', v::notEmpty()->alnum()->length(10))\n      ->key('department', v::notEmpty())\n      ->assert(['activity' => '', 'department' => '']);\n} catch(NestedValidationException $e) {\n    print_r($e->getMessagesIndexedByName()); // or just getMessagesByName() ?\n}\n```\n\nthe code above would reproduce:\n\n```\n[activity] => Array\n    (\n        [0] => activity must not be empty\n        [1] => activity must contain only letters (a-z) and digits (0-9)\n        [2] => activity must have a length greater than 10\n    ) \n[department] => Array\n    (\n        [0] => department must not be empty\n    )\n```\n\n``` php\ntry {\n    v::alnum()->length(6, 12)->setName('username')->assert('@');\n} catch(NestedValidationException $e) {\n    print_r($e->getMessagesIndexedByName());\n}\n```\n\nthe code above would reproduce:\n\n```\n[username] => Array\n    (\n        [0] => username must contain only letters (a-z) and digits (0-9)\n        [1] => username must have a length between 6 and 12\n    )\n```\n\nso far the only problem I've seen would be in case the input is empty/null and the user don't set a specific name with `setName('name')` then the arrays' indexes would be empty too.\n\n@henriquemoody what do you think about it?\n"},"comment":{"url":"https://api.github.com/repos/Respect/Validation/issues/comments/364789582","html_url":"https://github.com/Respect/Validation/issues/664#issuecomment-364789582","issue_url":"https://api.github.com/repos/Respect/Validation/issues/664","id":364789582,"user":{"login":"rifton007","id":2601347,"avatar_url":"https://avatars0.githubusercontent.com/u/2601347?v=4","gravatar_id":"","url":"https://api.github.com/users/rifton007","html_url":"https://github.com/rifton007","followers_url":"https://api.github.com/users/rifton007/followers","following_url":"https://api.github.com/users/rifton007/following{/other_user}","gists_url":"https://api.github.com/users/rifton007/gists{/gist_id}","starred_url":"https://api.github.com/users/rifton007/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rifton007/subscriptions","organizations_url":"https://api.github.com/users/rifton007/orgs","repos_url":"https://api.github.com/users/rifton007/repos","events_url":"https://api.github.com/users/rifton007/events{/privacy}","received_events_url":"https://api.github.com/users/rifton007/received_events","type":"User","site_admin":false},"created_at":"2018-02-11T21:16:26Z","updated_at":"2018-02-11T21:16:26Z","author_association":"NONE","body":"Hi,\r\nAny news about this feature ?"}}
{"actor":{"display_login":"rifton007"}}