{"action":"created","issue":{"url":"https://api.github.com/repos/symfony/symfony/issues/17644","repository_url":"https://api.github.com/repos/symfony/symfony","labels_url":"https://api.github.com/repos/symfony/symfony/issues/17644/labels{/name}","comments_url":"https://api.github.com/repos/symfony/symfony/issues/17644/comments","events_url":"https://api.github.com/repos/symfony/symfony/issues/17644/events","html_url":"https://github.com/symfony/symfony/pull/17644","id":130461144,"number":17644,"title":"Deprecate using Form::isValid() with an unsubmitted form","user":{"login":"GuilhemN","id":6871899,"avatar_url":"https://avatars.githubusercontent.com/u/6871899?v=3","gravatar_id":"","url":"https://api.github.com/users/GuilhemN","html_url":"https://github.com/GuilhemN","followers_url":"https://api.github.com/users/GuilhemN/followers","following_url":"https://api.github.com/users/GuilhemN/following{/other_user}","gists_url":"https://api.github.com/users/GuilhemN/gists{/gist_id}","starred_url":"https://api.github.com/users/GuilhemN/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GuilhemN/subscriptions","organizations_url":"https://api.github.com/users/GuilhemN/orgs","repos_url":"https://api.github.com/users/GuilhemN/repos","events_url":"https://api.github.com/users/GuilhemN/events{/privacy}","received_events_url":"https://api.github.com/users/GuilhemN/received_events","type":"User","site_admin":false},"labels":[{"id":100378,"url":"https://api.github.com/repos/symfony/symfony/labels/Feature","name":"Feature","color":"02e10c","default":false},{"id":99594,"url":"https://api.github.com/repos/symfony/symfony/labels/Form","name":"Form","color":"DDDDDD","default":false},{"id":237550465,"url":"https://api.github.com/repos/symfony/symfony/labels/Status:%20Reviewed","name":"Status: Reviewed","color":"bfe5bf","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":10,"created_at":"2016-02-01T19:40:49Z","updated_at":"2016-12-12T10:07:56Z","closed_at":"2016-06-17T17:33:33Z","pull_request":{"url":"https://api.github.com/repos/symfony/symfony/pulls/17644","html_url":"https://github.com/symfony/symfony/pull/17644","diff_url":"https://github.com/symfony/symfony/pull/17644.diff","patch_url":"https://github.com/symfony/symfony/pull/17644.patch"},"body":"| Q | A |\n| --- | --- |\n| Bug fix? | no |\n| New feature? | yes |\n| BC breaks? | no |\n| Deprecations? | yes |\n| Tests pass? | yes |\n| Fixed tickets | #7737 |\n| License | MIT |\n| Doc PR | not yet |\n\n> I'm calling out for you to decide how to resolve the inconsistency between the Form::isValid() method and the `valid` variable available in the template:\n> - `isValid()` returns `false` if a form was not submitted. This way it is possible to write concise controller code:\n> \n> ``` php\n> $form = $this->createForm(...);\n> $form->handleRequest($request);\n> if ($form->isValid()) {\n>     // only executed if the form is submitted AND valid\n> }\n> ```\n> - `valid` contains `true` if a form was not submitted. This way it is possible to rely on this variable for error styling of a form.\n> \n> ``` twig\n> <div{% if not form.vars.valid %} class=\"error\"{% endif %}>\n> ```\n> \n> We have two alternatives for resolving this problem:\n> 1. Leave the inconsistency as is.\n> 2. Make `isValid()` return `true` if a form was not submitted (consistent with `valid`)\n> 3. Revert to the 2.2 behavior of throwing an exception if `isValid()` is called on a non-submitted form (not consistent with `valid`).\n> \n> Both 2. and 3. will require additional code in the controller:\n> \n> ``` php\n> $form = $this->createForm(...);\n> $form->handleRequest($request);\n> if ($form->isSubmitted() && $form->isValid()) {\n>     // only executed if the form is submitted AND valid\n> }\n> ```\n> \n> What do you think?\n\nThis PR implements the option 3 as it was the most chosen in #7737\n"},"comment":{"url":"https://api.github.com/repos/symfony/symfony/issues/comments/266389087","html_url":"https://github.com/symfony/symfony/pull/17644#issuecomment-266389087","issue_url":"https://api.github.com/repos/symfony/symfony/issues/17644","id":266389087,"user":{"login":"lyrixx","id":408368,"avatar_url":"https://avatars.githubusercontent.com/u/408368?v=3","gravatar_id":"","url":"https://api.github.com/users/lyrixx","html_url":"https://github.com/lyrixx","followers_url":"https://api.github.com/users/lyrixx/followers","following_url":"https://api.github.com/users/lyrixx/following{/other_user}","gists_url":"https://api.github.com/users/lyrixx/gists{/gist_id}","starred_url":"https://api.github.com/users/lyrixx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lyrixx/subscriptions","organizations_url":"https://api.github.com/users/lyrixx/orgs","repos_url":"https://api.github.com/users/lyrixx/repos","events_url":"https://api.github.com/users/lyrixx/events{/privacy}","received_events_url":"https://api.github.com/users/lyrixx/received_events","type":"User","site_admin":false},"created_at":"2016-12-12T10:07:56Z","updated_at":"2016-12-12T10:07:56Z","body":"Hello.\r\n\r\nI know it's a bit late for this one, But I would like to vote for the 2/ options.\r\nIt makes code longer to write and, even if I understand your arguments here, I'm not sure it worth this change.\r\n\r\nOr We could implement something different: changing the value of `valid` is the template..."}}
{"actor":{"display_login":"lyrixx"}}