{"shas":[["9011edb0bca3da8049593d75d3a75443b7c6e955","bdfc83b49179f4905b3a5b06f3b74bb5172a9a16@notk.org","Removed the magical guessing of the type name to avoid WTF issues","Christophe Coevoet"],["5cbfc49a01041a219e94c2ec6cf0f1aff54e30cc","d4f8dcd89cfe40276c0fbf336903f4a05ab082c9@gmail.com","[Form] removed guesser for Choice constraints\n\nThe guesser has been removed as the constraints only knows\nabout the valid keys. But to be able to create the Type automatically,\nwe also need the values.","Fabien Potencier"],["825621cc77a68a0a524b844ff18588511745a80f","d4f8dcd89cfe40276c0fbf336903f4a05ab082c9@gmail.com","merged branch kertz/date_pattern (PR #694)\n\nCommits\n-------\n\nd08a688 [Form] Fixed CS\n954bdb5 [Form] Updated DateTimeType to accept a custom date pattern for the DateType child  * Added a test also about this change\ne7e744f [Form] Synced changes in this branch with current Symfony master branch\n436cb95 [Form] Changed to a CreateException when the 'format' option is invalid  * Updated DateTypeTest also\n0045ffe [Form] Added tests to check that the date format option is validated correctly  * Format option must be either a IntlDateFormatter constants (FULL, LONG, MEDIUM, SHORT) or a string\na815232 [Form] The IntlDateFormatter pattern can now be passed via the format option  * Also changed the default value of the calendar paramter to \\IntlDateFormatter:GREGORIAN    in DateTimeToLocalizedStringTransformer which is the same as the default value in    StubIntlDateFormatter\n58f869a [Form] Synced custom pattern tests with master branch\nc20edde [Form] Added some tests  * Tests to check if the pattern option is handled correctly by DateType  * Tests to check if the pattern parameter is handled correctly by DateTimeToLocalizedStringTransformer\n52a1e1d moved date_pattern to IntlDateFormatter\ndd104bc added code to use custom date_pattern\n\nDiscussion\n----------\n\n[Form] Added code to use custom date_pattern\n\nCurrent DateType doesn't make use of the `date_pattern` option. Added code to use the custom `date_pattern` if provided.\n\n---------------------------------------------------------------------------\n\nby maoueh at 2011/05/02 21:52:37 -0700\n\nYou should also pass the pattern option to the DateTimeToLocalizedStringTransformer so the pattern is taken in consideration when converting from and to localized string. You can check the commit I did on my repository (maoueh/symfony@01ae75dd842bc74be270) which do the same as yours for the DateType but also includes the modification needed by the DateTimeToLocalizedStringTransformer class.\n\nNot sure if there is more work needed to fully support the pattern option. Moreover, I did not run the tests to check if everything pass correctly. It would also be a good idea to add some tests to check that the date_pattern is working as expected.\n\n---------------------------------------------------------------------------\n\nby dot-i-fy at 2011/05/02 22:02:14 -0700\n\nThere is also a problem with the regex, but this is not regarding the pattern option. If you set the 'format' option to 0, it returns the IntlDateFormatter::FULL but it does not pass the regex because there is first EEEE in the standard pattern so it comes on the fallback pattern year month day\n\n---------------------------------------------------------------------------\n\nby kertz at 2011/05/02 23:36:05 -0700\n\nThanks for your suggestions @maoueh and @dot-i-fy, I will check them.\nI found the `date_pattern` doesn't work when using text widget. I will try to fix this.\n\n---------------------------------------------------------------------------\n\nby dot-i-fy at 2011/05/03 00:02:45 -0700\n\nHere the regex I use now and working with IntlDateFormatter::FULL\n\nhttps://gist.github.com/952929\n\n---------------------------------------------------------------------------\n\nby maoueh at 2011/05/03 07:13:01 -0700\n\n@kertz: It is working for me using the text widget on my development machine. Don't know what is the problem on our side but it is working correctly for me. I'm willing to help track this problem if you want. Just let me know.\n\n---------------------------------------------------------------------------\n\nby dot-i-fy at 2011/05/03 07:57:34 -0700\n\n@kertz : It is also working for me, we just have to pay attention about the format to be used in the text input regarding IntlDateFormatter.\n\n---------------------------------------------------------------------------\n\nby kertz at 2011/05/03 11:15:23 -0700\n\nAh well I guess I screwed up the whole commit log!\n\n---------------------------------------------------------------------------\n\nby dot-i-fy at 2011/05/03 11:19:08 -0700\n\nwow !\n\n---------------------------------------------------------------------------\n\nby maoueh at 2011/05/03 11:23:51 -0700\n\nHell yeah! :) You should do a rebase the next time instead of merging Symfony master branch into yours:\n `git rebase symfony/master date_pattern` and when you need to push your changes to your repository, do `git push -f origin date_pattern`. This way, it will be easier for the core team to handle the merge process.\n\nSince @dot-i-fy opened a pull request for fixing the same issue as here, maybe it would be a good idea to close this PR?\n\n---------------------------------------------------------------------------\n\nby kertz at 2011/05/03 11:33:34 -0700\n\nWell, it's done. I just pushed it a little earlier that I should have! Well I didn't know that @dot-i-fy opened a PR, where is it? This patch currently works for me.\n\nRegarding the change in regex, well I think it should also have a ChoiceList for week days, otherwise it's not useful. Probably that alone can be a separate PR.\n\n---------------------------------------------------------------------------\n\nby maoueh at 2011/05/03 11:46:09 -0700\n\nYep it is much better now :) I think it would be a good idea to remove this commit from your PR kertz/symfony@e47cfb6d49f84a05780c.\n\nThe other PR is [PR751](https://github.com/symfony/symfony/pull/751). Maybe @dot-i-fy could change is PR so it will only be about the regex? In both cases, you should coordinate with each other I think.\n\nThanks for merging the changes I made to the DateTimeToLocalizedStringTransformer class.\n\n---------------------------------------------------------------------------\n\nby dot-i-fy at 2011/05/03 12:00:06 -0700\n\nYeah, I will modify my commit to take only the regex in account.\n\nWould someone work with me on the TimeType ? The pattern is also not working there but it looks like a little bit more complicated!\n\nThanks\n\n---------------------------------------------------------------------------\n\nby kertz at 2011/05/03 12:02:18 -0700\n\nThanks for the changes in DateTimeToLocalizedStringTransformer.\n\nIs it really necessary to remove the initial commit?\n\n---------------------------------------------------------------------------\n\nby dot-i-fy at 2011/05/03 12:06:41 -0700\n\nWhat does it mean CS ?\n\n---------------------------------------------------------------------------\n\nby maoueh at 2011/05/03 12:08:44 -0700\n\n@dot-i-fy: It means Code Style, the comma is not placed correctly\n\n---------------------------------------------------------------------------\n\nby kertz at 2011/05/03 12:11:24 -0700\n\n`Coding Standards` seems right :) http://symfony.com/doc/2.0/contributing/code/standards.html\n\n---------------------------------------------------------------------------\n\nby dot-i-fy at 2011/05/03 12:11:27 -0700\n\nah ok, thx\n\n---------------------------------------------------------------------------\n\nby maoueh at 2011/05/03 12:12:10 -0700\n\n@kertz: I don't think it is strictly necessary to remove this commit. But I think it is a good idea since you kinda reverted it with some changes in a later commit. The core team might ask you to remove it. So leave it for now, and change it if they ask you to do so.\n\nHehe right, Coding Standards looks way better :)\n\n---------------------------------------------------------------------------\n\nby maoueh at 2011/05/03 12:30:00 -0700\n\n@dot-i-fy: I will check later in the evening what can be done about the pattern in the TimeType class. I'm also planning on adding some tests about this PR. If I do so, I will send a PR to your repository @kertz so you will be able to add the tests to this PR.\n\n---------------------------------------------------------------------------\n\nby dot-i-fy at 2011/05/03 13:04:35 -0700\n\nI had some problems with PHPUnit, seems to be ok now. Another problem, damned, APC is showing in my browser when in app_dev.php, not in prod. Any idea ? Can't get html output in dev env.\n\n---------------------------------------------------------------------------\n\nby dot-i-fy at 2011/05/04 00:43:46 -0700\n\n@RapotOR : Are you talking about the dateType method in IntlDateFormatter ? If no can you make a snippet in gist with an example ?\n\nIf yes ...The option \"format\" already allows an IntlDateFormatter input, you can either set a \\IntlDateFormatter::MEDIUM for example or an integer representing the dateType to use (0 -> full, 1 -> long, ... ).\n\nThe problem we are reveling here is the pattern based off the dateFormat option :\n\nthe $formatter look for Locale -> then for format option and based off these options he generate a pattern who can be different regarding the Locale. For example, for me I have my locale in php set to fr_BE, so my dates are always d-m-Y formatted but if I want to modify that it is momently not possible.\n\nGrtz\n\n---------------------------------------------------------------------------\n\nby RapotOR at 2011/05/04 00:57:03 -0700\n\n@dot-i-fy : my thought was more about having a full control of IntlDateFormatter from outside; instead of defining every variables. It is more like a DI way... especially if you have more than one DateType field!\n\n---------------------------------------------------------------------------\n\nby dot-i-fy at 2011/05/04 01:11:21 -0700\n\nOh so, it may be indeed a nice way to follow. Don't hesitate to submit your code suggestions.\nBut I think that if we go deeper in the core modifications, it is maybe a solution to take the $formatter out of the dateType class and put it in a own class and call it from the dateType class ???@}#\n\n---------------------------------------------------------------------------\n\nby maoueh at 2011/05/05 08:22:40 -0700\n\n@mweimerskirch: Maybe it would be better to rename your option html_pattern? Since the pattern is not strictly associated to a date type, it would be a better name in my opinion if it was named html_pattern or html5_pattern?\n\nI think it would lead to more misunderstandings if we had a date_pattern and a pattern option. In both cases, I agree totally that one or the other needs a renaming. Moreover, if we change the pattern option in the date type, I think the format option should be changed also to date_format.\n\nWhat do you think?\n\n---------------------------------------------------------------------------\n\nby kertz at 2011/05/05 23:58:21 -0700\n\n@mweimerskirch\n\nI too think when we specify `pattern` in `DateType` everyone expects it to be the date pattern. So maybe renaming the HTML5 pattern to `html_pattern` would be more appropriate?\n\n---------------------------------------------------------------------------\n\nby bschussek at 2011/05/18 12:20:56 -0700\n\nLooks good. Why don't we reuse the \"format\" option for this? If \"format\" is not one of the predefined constants, we could treat it as a custom date format.\n\n---------------------------------------------------------------------------\n\nby maoueh at 2011/05/18 12:28:22 -0700\n\n@bschussek: I think it is a good idea indeed. When I first played with forms, I thought that the purpose of the format option was exactly for this but I soon realized it wasn't. I'm +1 for this.\n\n@kertz: Let me know if you don't have time to do this switch, I will gladly submit the changes to you own repo if we agree to use \"format\" option instead of the \"pattern\" one.\n\n---------------------------------------------------------------------------\n\nby dot-i-fy at 2011/05/18 12:33:33 -0700\n\n``format`` and ``pattern`` options are related to the IntlDateFormatter, I also agree with you but we have to keep in mind that we will loose the symmetry with the IntlDateFormatter class.\n\n---------------------------------------------------------------------------\n\nby bschussek at 2011/05/18 13:39:07 -0700\n\nI think we can safely add this level of abstraction.\n\n---------------------------------------------------------------------------\n\nby kertz at 2011/05/18 20:29:11 -0700\n\n@maoueh Would be great if you can make the changes :)\n\n---------------------------------------------------------------------------\n\nby dot-i-fy at 2011/05/19 09:09:41 -0700\n\n@bschussek : I saw you removed pattern option, what are further intentions ?\n\n---------------------------------------------------------------------------\n\nby maoueh at 2011/05/19 09:42:40 -0700\n\n@kertz: I will do the changes needed tomorrow as I have some spare times. You will need to sync your branch with current master or I will need to send another PR since @bschussek removed the pattern option which will cause bad conflicts with this implementation.\n\n---------------------------------------------------------------------------\n\nby kertz at 2011/05/20 06:45:22 -0700\n\n@maoueh I've merged the changes.\n\n---------------------------------------------------------------------------\n\nby kertz at 2011/05/20 07:11:36 -0700\n\n@maoueh I just removed a couple of commits from the log. Seems like the tests you committed are now missing from the PR. Can you please send the tests once again? Sorry about that.\n\n---------------------------------------------------------------------------\n\nby maoueh at 2011/05/20 09:03:52 -0700\n\n@kertz: I will resend them along with the code modifications to use `format` instead of `pattern`.\n\n---------------------------------------------------------------------------\n\nby maoueh at 2011/05/20 19:11:28 -0700\n\nI did the changes to make it possible to pass a custom pattern via the format option. I sent a PR on @kertz repository [here](https://github.com/kertz/symfony/pull/2) that will be merge eventually in this PR.\n\nI have two small questions about it. First, since format option can now be a string, the allowed values for the option `format` have been removed from the array returned by `getAllowedOptionValues`. The check is done instead in the method `buildForm` directly. The 'format' option can be either one of the `IntlDateFormatter` constants (FULL, LONG, MEDIUM, or SHORT) or a string. If those conditions are not respected, a `FormException` is thrown. Is this correct?\n\nWhen the `format` option is a custom pattern, the IntlDateFormatter needs a valid format even if it will not be used. So I retrieved the default format option by using the `getDefaultOptions` method. Is this correct or should I specify the default value directly:\n\nthis (specify directly):\n\n    $format = \\IntlDateFormatter::MEDIUM;\n\ninstead of (use predefined defaults):\n\n    $defaultOptions = $this->getDefaultOptions($options);\n    $format = $defaultOptions['format'];\n\nAlso added more tests to verify that the format option is validated correctly and updated previous ones.\n\nRegards,\nMatt\n\n---------------------------------------------------------------------------\n\nby kertz at 2011/05/20 20:38:32 -0700\n\nMerged the changes. I have not tested this yet... Thanks @maoueh :)\n\n---------------------------------------------------------------------------\n\nby dot-i-fy at 2011/05/20 22:48:47 -0700\n\nnice job @maoueh\n\n---------------------------------------------------------------------------\n\nby mprizmic at 2011/06/16 14:06:47 -0700\n\nwhat do you think about\n$pattern = $form->getAttribute('pattern');\ninstead of\n$pattern = $form->getAttribute('formatter')->getPattern();\nin line 96 of\nsymfony/component/form/extension/core/type/datetype.php\n\n---------------------------------------------------------------------------\n\nby maoueh at 2011/06/16 14:40:37 -0700\n\nIt is simpler to use the pattern of the formatter directly I think. The reason is that if the option to change the format is null, the default pattern of the formatter will be available and will be the right pattern to use. If the option is set, we modify the formatter before hand so getting the pattern from it will return the custom pattern we have set in the options.\n\nSo in both cases, no conditional is required to verify if it is set or not when retrieving the pattern from the formatter. Moreover, I think the pattern must be set as an attribute of the form for your suggestion to work correctly which is not the case right now.\n\nRegards,\nMatt\n\n---------------------------------------------------------------------------\n\nby stloyd at 2011/07/05 13:41:36 -0700\n\n@fabpot What we do with that ? I have tried to rebase it with master, but my (Windows) git always gets insane and this ends up with unfixable error. This feature __should__ be in Symfony2 before final. Should I start work on it from \"none\" ?\n\n---------------------------------------------------------------------------\n\nby fabpot at 2011/07/06 05:44:26 -0700\n\n@stloyd: I need to review the patch first.","Fabien Potencier"],["59d6191cda320f4827f89623e0ed6956a633920d","d4f8dcd89cfe40276c0fbf336903f4a05ab082c9@gmail.com","merged branch stof/form_type (PR #1552)\n\nCommits\n-------\n\nef022c0 Removed the magical guessing of the type name to avoid WTF issues\n\nDiscussion\n----------\n\nRemoved the magical guessing of the type name to avoid WTF issues\n\nAs discussed on IRC, this removes the magical method to avoid breaking the user-land code by reusing the same name than another type which overrides it. This makes the user aware that a type should have a name as they now have to implement the method themselves.\n\n---------------------------------------------------------------------------\n\nby jalliot at 2011/07/06 05:35:30 -0700\n\nDoc and generator should be modified as well if it's merged.","Fabien Potencier"],["5a6fbd00a9d10633a3b737ef0c04cb83b00a9e44","2c7f9fd20fbeb41ce8894ec4653d66fa7f3b6e1a@weimerskirch.net","Fix error message","Michel Weimerskirch"]],"ref":"refs/heads/master","size":5,"head":"5a6fbd00a9d10633a3b737ef0c04cb83b00a9e44","push_id":35896343}