Commits
-------
c29fa9d [Form] Fix for treatment zero as empty data. Closes#1986
Discussion
----------
[Form] Fix for treatment zero as empty data. Closes#1986
For more info please read #1986.
Commits
-------
d880db2 [Form] Test covered fix for invalid date (13 month/31.02.2011 etc.) send to transformer. Closes#1755df74f49 Patched src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToArrayTransformer.php to throw an exception when an invalid date is passed for transformation (e.g. 31st February)
Discussion
----------
[Form] Fix for "DateTimeToArrayTransformer" with invalid dates
Hey,
this is test covered fix from @mdavis1982 (closes#1755)
---------------------------------------------------------------------------
by stloyd at 2011/08/16 01:31:32 -0700
@fabpot Can we have this fix merged ?
Commits
-------
1283c47 [HttpFoundation] Fixed incorrect test; MimeTypeGuesser should be (and is) able to detect a path that is not a file also without the 'fileinfo' extension
Discussion
----------
[HttpFoundation] Fixed incorrect test when 'fileinfo' extension is not enabled
This test failed on my box with `fileinfo` disabled. The `FileNotFoundException` is thrown also when the `fileinfo`-extension is not enabled, so it should be expected.
Commits
-------
266e60e Don't tell a lie to every WebServers
Discussion
----------
Please don't tell a lie to every WebServers
Fake Useragent name should be only in test case .
Commits
-------
86aeb04 [Form] Added skip for tests that require a higher version of the ICU library (needed by intl) than installed
Discussion
----------
[Form] Skip tests that are incompatible with the installed ICU (intl) library
Two tests for the `DateTimeToLocalizedStringTransformer` depend on a datetime-format that has only been added in version 3.8 of the ICU library (used by `intl`), see http://bugs.icu-project.org/trac/changeset/21815#file60. Some PHP-versions still ship with ICU 3.6 however.
This PR skips these tests when an incompatible version of the ICU library is detected. Unfortunately I had to copy-paste some code from `Symfony\Tests\Component\Locale\TestCase`, but I don't see any other way without creating a strange dependency between the tests for the Form and Locale components.
---------------------------------------------------------------------------
by Abhoryo at 2011/07/22 16:42:40 -0700
PHP 5.3.5 = ICU 3.6
PHP 5.3.6 = ICU 3.8
PHP 5.3.7rc4 = ICU 4.6
Since the RC3 of Symfony, config/check script recommends ICU 4.0+
---------------------------------------------------------------------------
by aboks at 2011/07/23 00:33:12 -0700
I noticed, but since it's not a hard requirement (and difficult for some people to install ICU 4.0+ at the moment) this PR would at least prevent false positives when people unable to upgrade run the test suite.
Commits
-------
04d0b6c [Console] Forced undecorated output in tests that rely on Application/Command-output being equal to a fixed value
Discussion
----------
[Console] Fixed tests that rely on undecorated Application/Command-output
Some tests compare the output of an `Application`/`Command` run to a fixed string. The output is decorated however (at least) when run on a Windows box with Ansicon installed.
This PR fixes these failing tests by forcing the `Application`/`Command`-output to be undecorated.
Commits
-------
03c7cfe UrlGenerator no longer appends '?' if query string is empty
Discussion
----------
UrlGenerator no longer appends '?' if query string is empty
If you generate a URL using null parameters (`array('foo' => null, 'bar' => null')`), `http_build_query` returns an empty string, resulting in a trailing `?` at the end of the generated URL.
This fixes that so that, if there are `$extra` params & `http_build_query` is empty, the URL is no longer appended.
---------------------------------------------------------------------------
by fabpot at 2011/07/22 10:15:26 -0700
Can you add unit tests?
---------------------------------------------------------------------------
by ericclemmons at 2011/07/22 10:52:21 -0700
Yes sir, will do.
-Eric Clemmons
Sent from my iPad Nano
On Jul 22, 2011, at 12:15 PM, fabpot<reply@reply.github.com> wrote:
> Can you add unit tests?
>
> --
> Reply to this email directly or view it on GitHub:
> https://github.com/symfony/symfony/pull/1773#issuecomment-1633515
---------------------------------------------------------------------------
by ericclemmons at 2011/07/22 11:55:30 -0700
**Added passing test.**
Currently `master` fails test:
```
1) Symfony\Tests\Component\Routing\Generator\UrlGeneratorTest::testUrlWithNullExtraParameters
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-http://localhost/app.php/testing
+http://localhost/app.php/testing?
//tests/Symfony/Tests/Component/Routing/Generator/UrlGeneratorTest.php:114
```
Revert "[Form] CollectionType now checks for data_class parameter instead of only class."
This reverts commit 2e024f87a3.
Conflicts:
tests/Symfony/Tests/Component/Form/Extension/Core/Type/CollectionTypeTest.php
Revert "[Form] Added ObjectFactoryListener. Fixes #1746."
This reverts commit 0327beb0b9.
Conflicts:
tests/Symfony/Tests/Component/Form/Extension/Core/Type/CollectionTypeTest.php
Commits
-------
eae6a77 fixed wrong case
d0a175bfixes#1659f300ede fixes several bugs
a4f05ac added some tests
Discussion
----------
Http util fixes
Fixes several bugs in the http utils.
Please don't add anymore features without sufficient tests. Especially for the Security\Http namespace, regressions are very likely otherwise.
---------------------------------------------------------------------------
by fabpot at 2011/07/19 22:37:26 -0700
Tests do not pass for me:
There were 2 errors:
1) Symfony\Bundle\SecurityBundle\Tests\Functional\LocalizedRoutesAsPathTest::testLoginLogoutProcedure with data set #0 ('en')
InvalidArgumentException: The current node list is empty.
.../src/Symfony/Component/DomCrawler/Crawler.php:604
.../src/Symfony/Bundle/SecurityBundle/Tests/Functional/LocalizedRoutesAsPathTest.php:16
2) Symfony\Bundle\SecurityBundle\Tests\Functional\LocalizedRoutesAsPathTest::testLoginLogoutProcedure with data set #1 ('de')
InvalidArgumentException: The current node list is empty.
.../src/Symfony/Component/DomCrawler/Crawler.php:604
.../src/Symfony/Bundle/SecurityBundle/Tests/Functional/LocalizedRoutesAsPathTest.php:16
--
There were 4 failures:
1) Symfony\Bundle\SecurityBundle\Tests\Functional\LocalizedRoutesAsPathTest::testAccessRestrictedResource with data set #0 ('en')
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-http://localhost/en/login
+http://localhost/login
.../src/Symfony/Bundle/Securitybundle/Tests/Functional/WebTestCase.php:22
.../src/Symfony/Bundle/SecurityBundle/Tests/Functional/LocalizedRoutesAsPathTest.php:38
2) Symfony\Bundle\SecurityBundle\Tests\Functional\LocalizedRoutesAsPathTest::testAccessRestrictedResource with data set #1 ('de')
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-http://localhost/de/login
+http://localhost/login
.../src/Symfony/Bundle/Securitybundle/Tests/Functional/WebTestCase.php:22
.../src/Symfony/Bundle/SecurityBundle/Tests/Functional/LocalizedRoutesAsPathTest.php:38
3) Symfony\Bundle\SecurityBundle\Tests\Functional\LocalizedRoutesAsPathTest::testAccessRestrictedResourceWithForward with data set #0 ('en')
HTTP/1.0 302 Found
Cache-Control: no-cache
Content-Length: 299
Content-Type: text/html; charset=UTF-8
Date: Wed, 20 Jul 2011 05:36:27 GMT
Location: http://localhost/login
Set-Cookie: PHPSESSID=11c9c6a7e7620e13bddef223a5ba46d9; path=/; domain=
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="refresh" content="1;url=http://localhost/login" />
</head>
<body>
Redirecting to <a href="http://localhost/login">http://localhost/login</a>.
</body>
</html>
Failed asserting that <integer:0> matches expected <integer:1>.
.../src/Symfony/Bundle/SecurityBundle/Tests/Functional/LocalizedRoutesAsPathTest.php:50
4) Symfony\Bundle\SecurityBundle\Tests\Functional\LocalizedRoutesAsPathTest::testAccessRestrictedResourceWithForward with data set #1 ('de')
HTTP/1.0 302 Found
Cache-Control: no-cache
Content-Length: 299
Content-Type: text/html; charset=UTF-8
Date: Wed, 20 Jul 2011 05:36:28 GMT
Location: http://localhost/login
Set-Cookie: PHPSESSID=2bbe63786a088471ade3717917f4ba4f; path=/; domain=
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="refresh" content="1;url=http://localhost/login" />
</head>
<body>
Redirecting to <a href="http://localhost/login">http://localhost/login</a>.
</body>
</html>
Failed asserting that <integer:0> matches expected <integer:1>.
.../src/Symfony/Bundle/SecurityBundle/Tests/Functional/LocalizedRoutesAsPathTest.php:50
---------------------------------------------------------------------------
by schmittjoh at 2011/07/19 23:47:29 -0700
I fixed a wrong case, but I couldn't reproduce the other errors (tested on Ubuntu).
My guess is that the temporary directory on your machine couldn't be deleted for some reason, and the test runs with the configuration of some of the previous tests.
---------------------------------------------------------------------------
by fabpot at 2011/07/20 00:28:41 -0700
That does not make any difference for me. For instance, in `LocalizedRoutesAsPathTest::testLoginLogoutProcedure()`, the first request to `'/'.$locale.'/login'` returns the following Response:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="refresh" content="1;url=http://localhost/login" />
</head>
<body>
Redirecting to <a href="http://localhost/login">http://localhost/login</a>.
</body>
</html>
---------------------------------------------------------------------------
by schmittjoh at 2011/07/20 00:31:34 -0700
That's weird, did you make sure that the temporary directory does not exist?
``rm -Rf /tmp/StandardFormLogin/``
On Wed, Jul 20, 2011 at 9:28 AM, fabpot <
reply@reply.github.com>wrote:
> That does not make any difference for me. For instance, in
> `LocalizedRoutesAsPathTest::testLoginLogoutProcedure()`, the first request
> to `'/'.$locale.'/login'` returns the following Response:
>
> <html>
> <head>
> <meta http-equiv="Content-Type" content="text/html;
> charset=utf-8" />
> <meta http-equiv="refresh" content="1;url=
> http://localhost/login" />
> </head>
> <body>
> Redirecting to <a href="http://localhost/login">
> http://localhost/login</a>.
> </body>
> </html>
>
> --
> Reply to this email directly or view it on GitHub:
> https://github.com/symfony/symfony/pull/1739#issuecomment-1613504
>
---------------------------------------------------------------------------
by fabpot at 2011/07/20 00:33:40 -0700
Yes, I've just checked and the directory does not exist.
---------------------------------------------------------------------------
by schmittjoh at 2011/07/20 00:39:55 -0700
Sorry, I can't reproduce it on Ubuntu and unless someone wants to sponsor me a Mac, there is not much I can do.
Commits
-------
95011ce [HttpFoundation] Fixed creation of requests without a path.
Discussion
----------
[HttpFoundation] Fixed creation of requests without a path.
Providing urls with no path led to php warning that the index 'path' is
not set. This patch initializes 'path' if no path is set.
Commits
-------
d37ff15 removed unused code
2d3051f tabs -> spaces
2c224ce improves the exception message, and removes unnecessary constraint to only allow strings inside strings
d0b056c fixes a bug where getParameterBag() always returns null
Discussion
----------
Fixes a bug in PHPDumper, and in parameter resolving
Commits
-------
eb85cc5 fixes a bug where the cookie was wrongly considered expired
Discussion
----------
fixes a bug where the cookie was wrongly considered expired
On a related note, what do you think about adding some more functional tests here? Not only phpunit, but I would also suggest to add behat tests since there are a lot of things which are not picked up by the in process request emulation, but only by a real client.
@fabpot, @everzet, what do you think?
Commits
-------
5e80c68 fixes a naming inconsistency
8cfca15 added change to upgrade file
4123ec4 updated some missing references
Discussion
----------
Fix inconsistent naming
---------------------------------------------------------------------------
by jalliot at 2011/07/15 08:15:01 -0700
I think you forgot one commit (the one effectively changing Session and that you reverted in the main repo)
---------------------------------------------------------------------------
by schmittjoh at 2011/07/15 09:07:17 -0700
You're right, fixed now.
Commits
-------
71cfb56 Thrown a \RuntimeException in RequestMatcher::checkIp6() if PHP is compiled with the option "disable-ipv6"
Discussion
----------
[HttpFoundation] Problem with RequestMatcher if PHP is compiled with the option "disable-ipv6"
Thrown a \RuntimeException in RequestMatcher::checkIp6() if PHP is compiled with the option "disable-ipv6".
Commits
-------
05cc24c [Yaml] Wrap numeric strings in quotes when dumping
Discussion
----------
[Yaml] Wrap numeric strings in quotes when dumping
This addresses an obscure case where a hash string (actually a commit-ish, "686e444") was dumped to YAML as an unquoted string value. It was later parsed from YAML as an exponential numeric and changed to ".Inf".
This commit should not change the existing behavior when dumping non-string numerics. It also doesn't appear to disturb any of the other test cases. I realize it's a huge edge case, so I'm open to discussion.
The alternative to this fix was an ugly `preg_replace()` to apply quoting around the commit-ish after dumping. I would look forward to removing that :)
This addresses an obscure case where a hash string (actually a commit-ish, "686e444") was dumped to YAML as an unquoted string value. It was later parsed from YAML as an exponential numeric and changed to ".Inf".
Commits
-------
64e9263 Updated UPDATE.md
7cf891a Renamed variable returned and used self in place of static for constants
f91f4dd Added the possibility to set cookies with the same name for different domains and paths for Symfony\Component\HttpFoundation\ResponseHeaderBag
f08eeb4 Moved managing cookies of HeaderBag in ResponseHeaderBag
Discussion
----------
[HttpFoundation] Cookies management in ResponseHeaderBag
Fixed cookies management in `Symfony\Component\HttpFoundation\HeaderBag` and `Symfony\Component\HttpFoundation\ResponseHeaderBag`
Commits
-------
52fdd53 [Bridge/Twig] Add required class to labels that match required fields
Discussion
----------
[Bridge/Twig] Add required class to labels that match required fields
I have used this to simply style labels that are required with a red star behind them using this CSS:
``` css
label.required::after {
content: " *";
color: #c00;
}
```
The problem is that you can't use `input[required] + label::after` as a selector since the label is typically rendered before the input. There is no way to check for an element that is *followed by* another, only elements *following*.
Of course this CSS in particular won't work except in the latest browsers, but you could still use the `label.required` selector to add a background image and so on. I think this is a very common use case and therefore I think it'd benefit the core framework.
---------------------------------------------------------------------------
by fabpot at 2011/07/05 01:27:49 -0700
Can you also update the PHP templates?
---------------------------------------------------------------------------
by schmittjoh at 2011/07/05 01:43:33 -0700
How about namespacing these css classes, like for example "sf-form-required"?
---------------------------------------------------------------------------
by stloyd at 2011/07/05 01:50:58 -0700
I would prefer an @schmittjoh naming, or even adding ability to setup it thought options.
---------------------------------------------------------------------------
by fabpot at 2011/07/05 01:54:36 -0700
Please, do not add more options. Prefix with `sf` is actually a good idea but people will argue that this is not a good idea because it gives too much information about the technology used to create the website (that's one of the things that came up pretty often in symfony1).
---------------------------------------------------------------------------
by schmittjoh at 2011/07/05 02:00:11 -0700
An option is not such a good idea imo since you likely want to have a uniform naming strategy across your entire site. How about adding a new service CssNamingStrategy?
---------------------------------------------------------------------------
by stloyd at 2011/07/05 02:01:19 -0700
Then this can be some simpler one not giving such informations i.e.: `form-label-required`, `label-required`, `framework-form-required`, `form-required` or whatever else ;-)
---------------------------------------------------------------------------
by fabpot at 2011/07/05 02:16:41 -0700
It cannot be configurable as it would potentially break bundles that come with stylesheets.
---------------------------------------------------------------------------
by stloyd at 2011/07/05 02:21:10 -0700
IMO if we decide to add this one, we could add same to `inputs/selects/etc` with `required` option.
---------------------------------------------------------------------------
by schmittjoh at 2011/07/05 02:21:59 -0700
I think it can, consider an interface like this:
```php
interface CssNamingStrategyInterface
{
function getCssName($class);
}
```
This will give people a lot of flexibility, and it also does allow them to exclude classes which for example are provided by third-party bundles.
---------------------------------------------------------------------------
by Seldaek at 2011/07/05 02:47:54 -0700
Wow guys, if this turns into a full blown class generator solution, I'm happy to close the PR.
"required" is not a name that's commonly used for main page elements, it's typically associated with forms, and therefore I don't see the need to make it unnecessary longer/namespaced. Similarly I don't see the need to add it to the input/select/.., because they already have an attribute, which you can very easily select as: `input[required]` in CSS. That works everywhere except IE6, but we can't build for the future on very old browsers. If you really want support for IE6, you can override the templates imo. But core should be looking forward, as it already is with HTML5, form markup, etc.
As for calling it form-label-required or label-required, again, I don't see the benefit, you can use `label.required` if you want to avoid conflicts with non-label elements having a required class, or a safer `form .required`. There are plenty of options in CSS itself, let's not make this overly complex.
---------------------------------------------------------------------------
by schmittjoh at 2011/07/05 02:52:17 -0700
see
http://code.google.com/intl/de-DE/speed/page-speed/docs/rendering.html#UseEfficientCSSSelectors
On Tue, Jul 5, 2011 at 11:47 AM, Seldaek <
reply@reply.github.com>wrote:
> Wow guys, if this turns into a full blown class generator solution, I'm
> happy to close the PR.
>
> "required" is not a name that's commonly used for main page elements, it's
> typically associated with forms, and therefore I don't see the need to make
> it unnecessary longer/namespaced. Similarly I don't see the need to add it
> to the input/select/.., because they already have an attribute, which you
> can very easily select as: `input[required]` in CSS. That works everywhere
> except IE6, but we can't build for the future on very old browsers. If you
> really want support for IE6, you can override the templates imo. But core
> should be looking forward, as it already is with HTML5, form markup, etc.
>
> As for calling it form-label-required or label-required, again, I don't see
> the benefit, you can use `label.required` if you want to avoid conflicts
> with non-label elements having a required class, or a safer `form
> .required`. There are plenty of options in CSS itself, let's not make this
> overly complex.
>
> --
> Reply to this email directly or view it on GitHub:
> https://github.com/symfony/symfony/pull/1519#issuecomment-1502560
>
---------------------------------------------------------------------------
by Seldaek at 2011/07/05 03:11:50 -0700
Really? Come on, we're talking about forms, it's not like you have billions of form/input tags per page that have to be parsed by the browser when you select that. Also you don't have to select the elements, if you want true performance just use no stylesheet, your users will thank you.
---------------------------------------------------------------------------
by schmittjoh at 2011/07/05 03:30:40 -0700
Your CSS selectors not only affect the performance of form elements, but of all elements that have a "required" class. Likewise, the same applies if we decide to add more classes.
Why close the door for people who care about performance? We can easily avoid this by making the css class more specific as suggested earlier. The idea with the renaming strategy is one step further and allows people to "obfuscate" which tool was used to generate the form, or do additional optimizations like shortening the css name.
---------------------------------------------------------------------------
by lenar at 2011/07/05 03:34:34 -0700
@Seldaek: Just for remark I've seen matrix forms spanning multiple screenfuls horizontally and vertically
containing tens of thousands inputs. Not pretty, but they do exist. Basically "poor" man's/company's excel
emulation or something.
---------------------------------------------------------------------------
by Seldaek at 2011/07/05 04:19:13 -0700
@schmittjoh, @lenar: We're catering to the most common use case, for which this will be more than fast enough. Small/medium scale websites don't have to optimize on CSS rules parsing, they usually have much bigger issues to deal with. If you really care about it, overriding the block to remove the class is just as easy as it was to for me to add it, but IMO this is the edge case.
---------------------------------------------------------------------------
by schmittjoh at 2011/07/05 05:37:19 -0700
IMO Symfony should follow best practices by encouraging to use class selectors, and not tag selectors for the reasons explained on the page I linked.
Anyway, I think everybody made his points. Time for @fabpot to make a decision :)
Commits
-------
df57e0f [Validator] Added strict option to ChoiceConstraint.
Discussion
----------
[Validator] Added strict option to ChoiceConstraint.
By default, ChoiceValidator was ensuring strict type when checking if value is present in choices. This behavior is a problem when you want to validate against integer values. As all data you will receive from a request will be typed as a string, you won't be able to validate these numeric values.
This patch solves this.
In order for being nice to developers, I've set "strict" to false by default.
Commits
-------
6786e81 [HttpFoundation] code factorization in UploadedFile
Discussion
----------
[HttpFoundation] code factorization in UploadedFile
As both #1542 and #1544 have been merged.
Commits
-------
ef022c0 Removed the magical guessing of the type name to avoid WTF issues
Discussion
----------
Removed the magical guessing of the type name to avoid WTF issues
As 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.
---------------------------------------------------------------------------
by jalliot at 2011/07/06 05:35:30 -0700
Doc and generator should be modified as well if it's merged.
Commits
-------
fa20b51 [Console] refactored definition printer
e49d61f [Console] fixed console help printing expectations
Discussion
----------
[Console] definitions printing fix
Before this change, console component printed definitions as:
``` bash
Arguments:
features Feature(s) to run. Could be a dir (features/),
a feature (*.feature) or a scenario at specific line
(*.feature:10).
Options:
--config (-c) Specify external configuration file to load. behat.yml or config/behat.yml will be used by default.
--profile (-p) Specify configuration profile to use. Define profiles in config file (--config).
--init Create features directory structure.
--format (-f) How to format features. pretty is default. Available formats are
- pretty
- progress
- html
- junit
--out Write formatter output to a file/directory instead of STDOUT (output_path).
--colors Force Behat to use ANSI color in the output.
--no-colors Do not use ANSI color in the output.
--no-time Hide time in output.
--lang Print formatter output in particular language.
--no-paths Do not print the definition path with the steps.
--no-snippets Do not print snippets for undefined steps.
--no-multiline No multiline arguments in output.
--expand Expand Scenario Outline Tables in output.
--story-syntax Print *.feature example in specified language (--lang).
--definitions Print available step definitions in specified language (--lang).
--name Only execute the feature elements (features or scenarios) which match part of the given name or regex.
```
As you might see, indentation is totally broken (also notice how it prints multiline descriptions in argument and --format option).
This PR makes output looks like this:
``` bash
Arguments:
features Feature(s) to run. Could be a dir (features/),
a feature (*.feature) or a scenario at specific line
(*.feature:10).
Options:
--config (-c) Specify external configuration file to load. behat.yml or config/behat.yml will be used by default.
--profile (-p) Specify configuration profile to use. Define profiles in config file (--config).
--init Create features directory structure.
--format (-f) How to format features. pretty is default. Available formats are
- pretty
- progress
- html
- junit
--out Write formatter output to a file/directory instead of STDOUT (output_path).
--colors Force Behat to use ANSI color in the output.
--no-colors Do not use ANSI color in the output.
--no-time Hide time in output.
--lang Print formatter output in particular language.
--no-paths Do not print the definition path with the steps.
--no-snippets Do not print snippets for undefined steps.
--no-multiline No multiline arguments in output.
--expand Expand Scenario Outline Tables in output.
--story-syntax Print *.feature example in specified language (--lang).
--definitions Print available step definitions in specified language (--lang).
--name Only execute the feature elements (features or scenarios) which match part of the given name or regex.
```
Commits
-------
d08a688 [Form] Fixed CS
954bdb5 [Form] Updated DateTimeType to accept a custom date pattern for the DateType child * Added a test also about this change
e7e744f [Form] Synced changes in this branch with current Symfony master branch
436cb95 [Form] Changed to a CreateException when the 'format' option is invalid * Updated DateTypeTest also
0045ffe [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
a815232 [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
58f869a [Form] Synced custom pattern tests with master branch
c20edde [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
52a1e1d moved date_pattern to IntlDateFormatter
dd104bc added code to use custom date_pattern
Discussion
----------
[Form] Added code to use custom date_pattern
Current DateType doesn't make use of the `date_pattern` option. Added code to use the custom `date_pattern` if provided.
---------------------------------------------------------------------------
by maoueh at 2011/05/02 21:52:37 -0700
You 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@01ae75dd84) which do the same as yours for the DateType but also includes the modification needed by the DateTimeToLocalizedStringTransformer class.
Not 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.
---------------------------------------------------------------------------
by dot-i-fy at 2011/05/02 22:02:14 -0700
There 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
---------------------------------------------------------------------------
by kertz at 2011/05/02 23:36:05 -0700
Thanks for your suggestions @maoueh and @dot-i-fy, I will check them.
I found the `date_pattern` doesn't work when using text widget. I will try to fix this.
---------------------------------------------------------------------------
by dot-i-fy at 2011/05/03 00:02:45 -0700
Here the regex I use now and working with IntlDateFormatter::FULL
https://gist.github.com/952929
---------------------------------------------------------------------------
by maoueh at 2011/05/03 07:13:01 -0700
@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.
---------------------------------------------------------------------------
by dot-i-fy at 2011/05/03 07:57:34 -0700
@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.
---------------------------------------------------------------------------
by kertz at 2011/05/03 11:15:23 -0700
Ah well I guess I screwed up the whole commit log!
---------------------------------------------------------------------------
by dot-i-fy at 2011/05/03 11:19:08 -0700
wow !
---------------------------------------------------------------------------
by maoueh at 2011/05/03 11:23:51 -0700
Hell yeah! :) You should do a rebase the next time instead of merging Symfony master branch into yours:
`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.
Since @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?
---------------------------------------------------------------------------
by kertz at 2011/05/03 11:33:34 -0700
Well, 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.
Regarding 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.
---------------------------------------------------------------------------
by maoueh at 2011/05/03 11:46:09 -0700
Yep it is much better now :) I think it would be a good idea to remove this commit from your PR kertz/symfony@e47cfb6d49.
The 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.
Thanks for merging the changes I made to the DateTimeToLocalizedStringTransformer class.
---------------------------------------------------------------------------
by dot-i-fy at 2011/05/03 12:00:06 -0700
Yeah, I will modify my commit to take only the regex in account.
Would someone work with me on the TimeType ? The pattern is also not working there but it looks like a little bit more complicated!
Thanks
---------------------------------------------------------------------------
by kertz at 2011/05/03 12:02:18 -0700
Thanks for the changes in DateTimeToLocalizedStringTransformer.
Is it really necessary to remove the initial commit?
---------------------------------------------------------------------------
by dot-i-fy at 2011/05/03 12:06:41 -0700
What does it mean CS ?
---------------------------------------------------------------------------
by maoueh at 2011/05/03 12:08:44 -0700
@dot-i-fy: It means Code Style, the comma is not placed correctly
---------------------------------------------------------------------------
by kertz at 2011/05/03 12:11:24 -0700
`Coding Standards` seems right :) http://symfony.com/doc/2.0/contributing/code/standards.html
---------------------------------------------------------------------------
by dot-i-fy at 2011/05/03 12:11:27 -0700
ah ok, thx
---------------------------------------------------------------------------
by maoueh at 2011/05/03 12:12:10 -0700
@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.
Hehe right, Coding Standards looks way better :)
---------------------------------------------------------------------------
by maoueh at 2011/05/03 12:30:00 -0700
@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.
---------------------------------------------------------------------------
by dot-i-fy at 2011/05/03 13:04:35 -0700
I 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.
---------------------------------------------------------------------------
by dot-i-fy at 2011/05/04 00:43:46 -0700
@RapotOR : Are you talking about the dateType method in IntlDateFormatter ? If no can you make a snippet in gist with an example ?
If 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, ... ).
The problem we are reveling here is the pattern based off the dateFormat option :
the $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.
Grtz
---------------------------------------------------------------------------
by RapotOR at 2011/05/04 00:57:03 -0700
@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!
---------------------------------------------------------------------------
by dot-i-fy at 2011/05/04 01:11:21 -0700
Oh so, it may be indeed a nice way to follow. Don't hesitate to submit your code suggestions.
But 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 ???@}#
---------------------------------------------------------------------------
by maoueh at 2011/05/05 08:22:40 -0700
@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?
I 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.
What do you think?
---------------------------------------------------------------------------
by kertz at 2011/05/05 23:58:21 -0700
@mweimerskirch
I 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?
---------------------------------------------------------------------------
by bschussek at 2011/05/18 12:20:56 -0700
Looks 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.
---------------------------------------------------------------------------
by maoueh at 2011/05/18 12:28:22 -0700
@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.
@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.
---------------------------------------------------------------------------
by dot-i-fy at 2011/05/18 12:33:33 -0700
``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.
---------------------------------------------------------------------------
by bschussek at 2011/05/18 13:39:07 -0700
I think we can safely add this level of abstraction.
---------------------------------------------------------------------------
by kertz at 2011/05/18 20:29:11 -0700
@maoueh Would be great if you can make the changes :)
---------------------------------------------------------------------------
by dot-i-fy at 2011/05/19 09:09:41 -0700
@bschussek : I saw you removed pattern option, what are further intentions ?
---------------------------------------------------------------------------
by maoueh at 2011/05/19 09:42:40 -0700
@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.
---------------------------------------------------------------------------
by kertz at 2011/05/20 06:45:22 -0700
@maoueh I've merged the changes.
---------------------------------------------------------------------------
by kertz at 2011/05/20 07:11:36 -0700
@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.
---------------------------------------------------------------------------
by maoueh at 2011/05/20 09:03:52 -0700
@kertz: I will resend them along with the code modifications to use `format` instead of `pattern`.
---------------------------------------------------------------------------
by maoueh at 2011/05/20 19:11:28 -0700
I 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.
I 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?
When 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:
this (specify directly):
$format = \IntlDateFormatter::MEDIUM;
instead of (use predefined defaults):
$defaultOptions = $this->getDefaultOptions($options);
$format = $defaultOptions['format'];
Also added more tests to verify that the format option is validated correctly and updated previous ones.
Regards,
Matt
---------------------------------------------------------------------------
by kertz at 2011/05/20 20:38:32 -0700
Merged the changes. I have not tested this yet... Thanks @maoueh :)
---------------------------------------------------------------------------
by dot-i-fy at 2011/05/20 22:48:47 -0700
nice job @maoueh
---------------------------------------------------------------------------
by mprizmic at 2011/06/16 14:06:47 -0700
what do you think about
$pattern = $form->getAttribute('pattern');
instead of
$pattern = $form->getAttribute('formatter')->getPattern();
in line 96 of
symfony/component/form/extension/core/type/datetype.php
---------------------------------------------------------------------------
by maoueh at 2011/06/16 14:40:37 -0700
It 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.
So 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.
Regards,
Matt
---------------------------------------------------------------------------
by stloyd at 2011/07/05 13:41:36 -0700
@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" ?
---------------------------------------------------------------------------
by fabpot at 2011/07/06 05:44:26 -0700
@stloyd: I need to review the patch first.
Commits
-------
3df5ec3 [HttpKernel] Add support for 'upload_max_filesize' ini directive in the Client
Discussion
----------
[HttpKernel] Add support for 'upload_max_filesize' ini directive
[HttpKernel] Add support for 'upload_max_filesize' ini directive in the Client
__This PR depends on #1542__
This PR prevent the SW Client from uploading files larger than the limit set in php.ini to closer mimic a real browser usage.
If both PR eventually gets merge `static protected function getMaxUploadFilesize()` should probably be factorized to the UploadedFile class.
---------------------------------------------------------------------------
by stloyd at 2011/07/05 13:35:06 -0700
+1 for both, I just have found similar "wtf" issues with "empty" `upload_max_filesize`.
---------------------------------------------------------------------------
by oscarballadares at 2011/07/05 15:13:23 -0700
I have opened an issue related to UPLOAD_ERR_INI_SIZE. There was no way to handle this exception.
Can you confirm please?
If this is the case I will close the issue I opened.
---------------------------------------------------------------------------
by vicb at 2011/07/05 23:04:08 -0700
@oscarballadares the PR you are looking for is most probably #1542 - which you should see in the message thread of your submitted issue.
The best would be for you to verify that PR #1542 fixes your issue and provide some feedback so that the issue can be close but only when the PR gets merged (if it fixes the issue).
Commits
-------
d58ba34 [Validator] Consider the ini directive 'upload_max_filesize' while validating an uploaded file (fixes GH-1441)
Discussion
----------
[Validator] FileValidator support for uploaded files
[Validator] Consider the ini directive 'upload_max_filesize' while validating an uploaded file (fixes GH-1441)
Added validator messages should get translated in all the available languages.
Commits
-------
03fee4f Fix permissions
431460f [Form] Remove choice or choice_list requirement as the following conditions already check enough and this condition prevents empty select forms (populated by ajax for example)
Discussion
----------
[Form] Choice fix
[Form] Remove choice or choice_list requirement as the following conditions already check enough and this condition prevents empty select forms (populated by ajax for example)
---------------------------------------------------------------------------
by stloyd at 2011/07/05 06:26:36 -0700
You should revert permission changes.
---------------------------------------------------------------------------
by fabpot at 2011/07/05 06:28:14 -0700
Why not replacing `if (!$options['choices'] && !$options['choice_list']) {` by `if (!isset($options['choices']) && !isset($options['choice_list'])) { `?
---------------------------------------------------------------------------
by beberlei at 2011/07/05 06:35:50 -0700
gnaa permission changes, i cant seem to configure my machine such that it does not do it, i have to do this on a per repository basis, very annoying.
@fabpot isset() is already guaranteed because these two options are in the defaults.
---------------------------------------------------------------------------
by beberlei at 2011/07/05 06:39:43 -0700
Fixed the permissions
---------------------------------------------------------------------------
by stof at 2011/07/05 06:48:37 -0700
@beberlei Can't you fix it in the global git config ?
---------------------------------------------------------------------------
by webda2l at 2011/07/05 09:48:58 -0700
I met the same problem this afternoon and vote for the isset solution. Better than nothing and work for me.
https://github.com/symfony/symfony/pull/1539
---------------------------------------------------------------------------
by stof at 2011/07/05 09:50:09 -0700
@webda2l why is a check that always return true better than nothing ? It adds overhead without adding any value in the code.
Commits
-------
3917ed7 Revert "* DateType, DateTimeType, TimeType: - a bit changed readability"
c85b815 Fixed few issues with Date and Time:
Discussion
----------
[Form] Fixed few issues with Date and Time
Fixed few issues with Date and Time:
* TimeType:
- seconds are no longer populated if "with_seconds" = false
- "widget = text" is now properly rendered (closes#1480)
* DateTimeToStringTransformer:
- fixed using not default "format" (probably fix#1183)
* DateType, DateTimeType, TimeType:
- fixed "input = datetime" and test covered
Commits
-------
164aea4 [Security] Add tests for the channel listener
d51cbc0 [Security] Remove useless attribute in basic authentication listener & test it
91e6dc9 [Security] Add tests for the anonymous authentication listener
3c2affb [Security] Update access listener constructor's prototype and add tests
81afd77 [Security] Add tests for the firewall map
aa6ae33 [Security] Remove useless attribute & var in firewall
Discussion
----------
Test security
---------------------------------------------------------------------------
by lsmith77 at 2011/06/29 13:41:07 -0700
@schmittjoh is probably the person to review this change ..
Commits
-------
418d6a0 [Routing] Fix syntax error when dumping routes with single quotes in the requirements or pattern
2b5e22d [Routing] Fix ApacheDumper when a space appears in a default value
6c7f484 [Routing] Fix dumper so it doesn't print trailing whitespace
761724a [Routing] Adjust urlescaping rules, fixes#752
Discussion
----------
[Router] Bunch o' Fixes
The first commit changes the escaping rule to fix issues I had previously, and #752 as well, here's from the full commit message:
Only + and % are now encoded in generated routes, since they are the only characters that, if not encoded, could cause problems/conflicts when decoded. Namely + turns into a space, and % followed by numbers could do funky things.
The matcher decodes everything which works since nothing will have %NN without being escaped, and + are escaped as well.
Second commit is just a test fix for the first
Third and fourth are simply dumper escaping issues, nothing to argue about.
Note that all changes have had test cases added, and I spent a few hours torturing/testing all this stuff with both Apache and PHP dumpers, in many browsers, and with URLs as wonky as `/%01%02%03%04%05%06%07%08%0E%0F%10%11%12%13%14%15%16%17%18%19%1A%1B%1C%1D%1E%1F%20!%22$%25&%27%28%29*+,-./0123456789:;%3C=%3E@ABCDEFGHIJKLMNOPQRSTUVWXYZ%5B%5D%5E_%60abcdefghijklmnopqrstuvwxyz%7B|%7D~/baz` which essentially represent the 1-255 char range minus ? and #.
The only issues I really encountered after all the patches were applied is that Apache refuses to match `%22` (= `"`) and `*` in a url. I guess it's just because they're not allowed chars in windows paths, but | and < > works fine though. Anyway this works with the PHP dumper, and it didn't work either without my patches so it's not like I broke it, I'm just saying for the record.
Commits
-------
1cc1027 added @Annotation to UniqueEntity
ee22c5d added a note to update file
efcb435 updated to doctrine changes
Discussion
----------
updated to doctrine changes
---------------------------------------------------------------------------
by excelwebzone at 2011/06/30 06:29:23 -0700
Should also be implemented to the Route class and to all SensioFrameworkExtraBundle annotation classes
* TimeType:
- seconds are no longer populated if "with_seconds" = false
- "widget = text" is now properly rendered (closes#1480)
* DateTimeToStringTransformer:
- fixed using not default "format" (probably fix#1183)
* DateType, DateTimeType, TimeType:
- fixed "input = datetime" and test covered
- a bit changed readability
Only + and % are now encoded in generated routes, since they are the only characters that, if not encoded, could cause problems/conflicts when decoded. Namely + turns into a space, and % followed by numbers could do funky things.
The matcher decodes everything which works since nothing will have %NN without being escaped, and + are escaped as well.
Commits
-------
f4c7333 Fix populating seconds when option "with_seconds" is set to false
Discussion
----------
[Form][DateTimeType] Fix invalid data when "with_seconds" = false
Fix populating seconds when option `with_seconds` is set to `false`.
Commits
-------
4e3406d Sync with master and clean up
ad5d2c1 Added to `TimeType` extension possibility to render form as `single_text` (similar to DateType option) (issue #1205) Adjusted `DateTimeType` to allow usage of this new feature
Discussion
----------
[Form][TimeType] Added possibility to render form as "single_text"
Added to `TimeType` extension possibility to render form as `single_text` (similar to `DateType` option) (issue #1205)
Adjusted `DateTimeType` to allow usage of this new feature
---------------------------------------------------------------------------
by ouardisoft at 2011/06/17 03:41:18 -0700
+1
---------------------------------------------------------------------------
by stloyd at 2011/06/21 01:05:51 -0700
@fabpot Any decision about this one ? I'm asking because I also have similar fix for #1323 but it requires this one ;-)
---------------------------------------------------------------------------
by fabpot at 2011/06/22 23:32:08 -0700
@stloyd: Can you rebase to master?
---------------------------------------------------------------------------
by stloyd at 2011/06/23 05:03:44 -0700
@fabpot Done.
Commits
-------
7db0b95 [HttpKernel] Removed unnecessary strtoupper
0891c57 [HttpKernel] Added test
1350645 [HttpKernel] Uppercased a few http methods
05c9906 [HttpKernel] Suppress response content for 304 responses out of the cache
Discussion
----------
HttpCache changes for 304 responses
Fixes#1413
Commits
-------
2d29a82 New test for Process, testing stdout and stderr at different stream sizes
Discussion
----------
Make run() fully non-blocking and fix potential other problems
Multiple changes:
1) make writing to process non-blocking too - otherwise there might be increased possibility for buffer deadlock
given big enough input data. Also now it's guaranteed that all stdin data will be written.
2) get rid of fgets() - fgets() isn't really good function to use in case of non-blocking sockets. Data loss possible.
---------------------------------------------------------------------------
by fabpot at 2011/06/22 07:11:55 -0700
Does it make https://github.com/symfony/symfony/pull/1365 obsolete?
---------------------------------------------------------------------------
by lenar at 2011/06/22 14:08:14 -0700
@fabpot: After reading, I really don't know. Let's hope. But ...
I now improved Process tests a bit to test stdout, stderr with different stream sizes and different
behaviours of child processes. Added it to non-blocking-process branch, commit 2d29a82412.
In my case, nothing fails, but maybe this helps other people. Or Windows people - I myself cannot test on Windows.
---------------------------------------------------------------------------
by fabpot at 2011/06/22 22:59:55 -0700
These tests pass on my Linux box but fail on my Mac.
---------------------------------------------------------------------------
by fabpot at 2011/06/22 23:05:14 -0700
Actually, on the Mac, the tests behave correctly but the exit code is `-1` instead of `0`.
---------------------------------------------------------------------------
by lenar at 2011/06/23 01:23:51 -0700
Could you check if the $this->status['running'] (after call to proc_get_status()) is true in the case you get -1.
On my linux I got it -1 couple of times. 99% of time it doesn't happen. I theorized it's because sometimes the child
process isn't finished enough and finally I got confirmation too that in case of -1 the process is still running (stats['running'] === true).
But it's really almost unreproducible on my Linux. So if you have this value every time it might be easier for you to find solution.
What comes into my mind:
1) maybe we should poll, let's say if process is still running we usleep(1000) and the try proc_get_status() again until not running. Maybe up to a 1 sec.
2) maybe, if the process is still running we can trust the return value subsequently given by proc_close()?
Or maybe there's some other problem on Mac.
Commits
-------
d49e306 [DomCrawler] Fixed handling of relative query strings as links
a4451b4 [DomCrawler] Added tests for links starting with ?foo
Discussion
----------
[DomCrawler] Fixed handling of relative query strings as links
The link object concatenates links containing only a query string to the current URI. This shouldn't happen if the current URI already contains a query string.
This PR fixes the incorrect behavior (tests included).
Commits
-------
7783a05 Removed unused code from DateType Additional tests for ChoiceType and DateType based code
cdd39ac Added ability to set "empty_value" for `DateTimeType`, `DateType` and `TimeType` Additional tests covering added code
af4a7d7 More tests and more compatible code, with some suggestions from @helmer
527b738 Test covered version of fix for issue #1336
Discussion
----------
[Form] Added ability to set "empty_value" for choice list
Hey,
This PR is similar to #1336, but this one is fully test covered and have few change in behavior:
- if choice field is not set as non-required, `empty_value` is not added automaticly,
- also `empty_value` is not set if field have option `multiple` or `expanded`,
- `empty_value` for `DateType` and `TimeType` can be set "global" or per field, i.e.:
```
$builder->add('date', 'choice', array('required' => false, 'empty_value' => array('day' => 'Choose day')));
```
- `DateType` and `TimeType` code was cleaned a bit,
- added missing option to set up choice list as required when using PHP templates
---------------------------------------------------------------------------
by stloyd at 2011/06/20 04:55:45 -0700
@fabpot I'm just not sure is that change with removing "auto-adding" of `empty_value` is good (probably BC)
---------------------------------------------------------------------------
by lenar at 2011/06/20 05:24:02 -0700
Now this is a really nice way to hijack work done by others. Really encourages newcomers. Gratz!
---------------------------------------------------------------------------
by fabpot at 2011/06/20 05:57:40 -0700
@lenar: if the code in this PR is yours (at least partly), I'm not going to merge it. @stloyd, can you clarify this issue with @lenar? Thanks.
---------------------------------------------------------------------------
by lenar at 2011/06/20 06:21:11 -0700
It's @helmer's mostly, not mine, but the issue stays.
---------------------------------------------------------------------------
by fabpot at 2011/06/20 06:26:15 -0700
No matter who the code belongs to, Git allows us to keep track of all contributors. So, we need to do our best to not loose any code ownership.
---------------------------------------------------------------------------
by helmer at 2011/06/20 06:58:03 -0700
I do not care much for ownership, just that this kind of cooperation (or lack thereof) is kind of exhausting. Closed#1336.
---------------------------------------------------------------------------
by stloyd at 2011/06/20 07:47:53 -0700
@fabpot, @lenar: This PR is inspired by #1336, made by @helmer, but after looking at his code and talking with him, we cant (IMO) get an consensus. So I wrote this PR as an another way to fix issue described in #1336.
__Summary__: I don't think this one is better than fix at #1336, it's more like another approach to fix that issue.
---------------------------------------------------------------------------
by helmer at 2011/06/20 08:15:59 -0700
@stloyd: I actually think your variant is better, so good job there, thanks.
It just ain't nice to:
1) Comment on my changes being useless due to lack of tests
2) Writing brand new testsuite from your perspective that "proves" my approach is "wrong" (while ignoring my answers, why I did something precisely like I did, which I did in sync with @fabpot comments on his first attempt to improve the issue)
3) Saying my PR is broken because your new tests against it fail
4) Changing functionality to "fix" something that was not really broken
Other than that, I wanted to contribute a few lines to improve something relatively simple, and it ended up in a huge mess with more lost hours than I planned to spend on it.
On the bright side, we ended up with something good (:
---------------------------------------------------------------------------
by stloyd at 2011/06/20 08:32:30 -0700
@helmer: 1) & 2) Sorry for that "bad language", but you get me wrong a bit. Tests was written for code in master (there was no problem to change them to work with your POV). 3) Same as before, you can adopt tests easily, but never mind. Maybe later we could cooperate better ;-)
About 4) I mentioned it in description of this PR and that was point I was disagreeing with you (also about how "default" options are adopted in fields) :-)
Commits
-------
5d46e63 [Form] Add the FormHelper configuration
a43fad4 [Form] Improve unit tests for rendering
1cb2129 [FrameworkBundle][Form] Adding a cache to FormHelper::lookupTemplate()
f39ce67 [Form][FrameworkBundle] PHP theming
Discussion
----------
[2.1] RFC [Form] Php theming
This PR implements theming support for the php engine.
It works similarly as the twig theming with themes being folders and blocks being individual files.
There are probably a few things to tune before this can get merged:
### Theme naming
The current format is "\<Bundle\>:\<Controller\>" i.e. "FrameworkBundle:Form".
Is this ok or could you imagine something better ?
### Div and Table theme folders
Currently "FrameworkBundle\\Resources\\views\\Form" and "FrameworkBundle\\Resources\\views\\FormTable"
Is this ok or anything better ?
### Form helper configuration
I am not sure if the configuration is at the best possible location:
```
framework:
templating:
form:
resources: [themeA, themeB]
```
Any better idea ?
There is a [thread on the ml](http://groups.google.com/group/symfony-devs/browse_thread/thread/9b3f131fe116b511)
Commits
-------
7af003b [HttpFoundation] Allow stringable objects and numbers in response body + added tests
8126fb7 [HttpFoundation] Ensure response body is string, fixes#1378
Discussion
----------
[HttpFoundation] Ensure response body is string, fixes#1378
The issue in #1378 is clearly just a misuse of the class due but the error it triggers is confusing. This hopes to fix that.
---------------------------------------------------------------------------
by Seldaek at 2011/06/21 04:08:40 -0700
Added tests and support for __toString + numbers (kinda pointless but well..)
This change removes the need for the {_locale} hack.
Now, all paths in the Security component can be:
* An absolute path (/login)
* An absolute URL (http://symfony.com/login)
* A route name (login)
So, if you want to use a path that includes a global parameter (like _locale),
use a route instead of a path.
Commits
-------
2c1108c [Form] Revert the ability to override anything else than the text of the label while rendering a row
da467a6 [Form] Fix the exception message when no block is found while rendering
8670995 [Form] Optimize rendering when the block to render is known
41e07c9 [Form] Optimize rendering
ee5d975 [Form] Remove a test which is no more relevant (after recent FileType refactoring)
f729c6b [Form] Add the ability to override label & widget options when rendering a row
e09ae3f [Form][FrameworkBundle] Make FormHelper::renderSection() recursively callable, introduce FormHelper::renderBlock()
e43fb98 [Form][TwigBridge] Make FormExtension::render() recursively callable to ease theming
Discussion
----------
[Form] Some refactoring of the rendering
# First two commits
## FormExtension::render() can now be called recursively.
The main use case is theming support in for collections. Let's consider that you have a collection of `CustomType`, the type hierarchy while rendering the proto would be `field < form < custom < prototype`. Before this change any theme applied to your custom type (i.e. a `custom_row` block) would not have been taken into account while rendering the prototype because of the structure of the `prototype_row` block:
```html
{% block prototype_row %}
{% spaceless %}
<script type="text/html" id="{{ proto_id }}">{{ block('field_row') }}</script>
{% endspaceless %}
{% endblock prototype_row %}
```
which skip the `custom_row` block rendering to fallback to the `field_row` block rendering.
With this PR `prototype_row` recursively calls `FormExtension::render()`
```html
{% block prototype_row %}
{% spaceless %}
<script type="text/html" id="{{ proto_id }}">{{ form_row(form) }}</script>
{% endspaceless %}
{% endblock prototype_row %}
```
this has for effect to render the block for the parent type (i.e. `custom_row`)
## FormHelper
The `FormHelper` has been updated to more closely match the `FormExtension` architecture and the templates have been modified accordingly. `echo $view['form']->renderBlock(<block name>)` is the php equivalent of `{{ block(<block name>) }}`.
The attributes are now rendered using a template rather than by the `FormHelper::attributes()` method.
Several templates have been fixed.
# Third commit
The `$varStack` property was used to forward options to the label and the widget when rendering a row. The implementation was not working as expected. The proposed way to override label and widget options is to pass these options in the `label` and `widget` keys while callinf `render_row`.
That would be:
`{{ form_row(form.field, {"attr": {<row attributes>}, "label" : {"label": <text>, "attr": {<label attr>}}, "widget" : { "attr" : {<widget attributes}} } }}`
So there is now the ability to set attributes for the row (`<div>` or `<tr>`).
This has been discussed on [the mailing list](http://groups.google.com/group/symfony-devs/browse_thread/thread/17754128ba480545). **I would like to find a compromise with @Seldaek before this gets merged**
The `$varStack` property is now only used when recursively calling `FormExtension::render()`
# Notes
I have preferred to submit several commits in order to ease review and to keep some history.
---------------------------------------------------------------------------
by stof at 2011/06/20 05:20:56 -0700
@vicb On a side note, do you think it would be possible to support form theming in PHP templates too ? Currently, the only way to customize the rendering of forms when using PHP templates is to overwrite the FrameworkBundle's templates, and this impacts all forms. This makes the PHP rendering far less powerful than the Twig one.
I don't know the Form rendering and the PHPEngine well enough to know if it is feasible for 2.1 or not.
---------------------------------------------------------------------------
by vicb at 2011/06/20 05:35:11 -0700
@stof I hope to make it possible but I need a little bit more thinking to find the best possible solution which should not look like a hack.
---------------------------------------------------------------------------
by vicb at 2011/06/21 01:13:10 -0700
This should not be merged yet, it might have some issue with the variable stack. I am working on it.
---------------------------------------------------------------------------
by vicb at 2011/06/21 01:41:11 -0700
Sorted out the issue, it was linked to some local _optimization_, the code of this PR is ok.
---------------------------------------------------------------------------
by vicb at 2011/06/21 02:01:24 -0700
I have pushed a [POC of php theming based on this PR](https://github.com/vicb/symfony/commits/form%2Fphp-theme) to my repo - it is lacking a configuration and cache layer.
I have open [a thread on the ml](http://groups.google.com/group/symfony-devs/browse_thread/thread/9b3f131fe116b511) to discuss this.
---------------------------------------------------------------------------
by vicb at 2011/06/21 23:40:21 -0700
@fabpot fixed in the last commit.
Commits
-------
159fc0e [Validator] Added symbols to IDNs validation
c827faf [Validator] Add support for IDNs and custom TLDs
Discussion
----------
[Validator] Add support for IDNs and custom TLDs
Minor changes to allow for IDNs and [custom TLDs](http://news.softpedia.com/news/ICANN-Approves-New-Custom-Generic-Top-Level-Domains-Like-google-bank-206977.shtml). This is the only sane way to support everything in a timeless manner.
---------------------------------------------------------------------------
by stealth35 at 2011/06/20 04:32:09 -0700
maybe it should be check the host with idn_to_ascii (if function exists, maybe it's should recreate un punycode en/decoder in the stub)
---------------------------------------------------------------------------
by mvrhov at 2011/06/20 04:40:10 -0700
/me :faceslap.
Haven't seen the link in PR
---------------------------------------------------------------------------
by Seldaek at 2011/06/20 04:40:40 -0700
@mvrhov: Yup, that's what pushed me to reconsider adding this.
@stealth35: I'm not sure if this is needed. I don't want this to be too strict, with another validator or with an extra option I think we can make a check that the domain actually exists, or do a GET / on it or something, but this just checks validity of the syntax.
---------------------------------------------------------------------------
by stealth35 at 2011/06/20 04:48:05 -0700
I understand :)
what about funny IDN like : [☎.com] (http://xn--y3h.com/) ?
---------------------------------------------------------------------------
by Seldaek at 2011/06/20 04:53:19 -0700
@stealth35: Fixed
---------------------------------------------------------------------------
by stealth35 at 2011/06/20 04:56:18 -0700
it's seem great,for acceptable chars [RFC] (http://www.faqs.org/rfcs/rfc3490.html) said (with UseSTD3ASCIIRules option) :
(a) Verify the absence of non-LDH ASCII code points; that is, the
absence of 0..2C, 2E..2F, 3A..40, 5B..60, and 7B..7F.
Commits
-------
72d0ebe9 [WebProfilerBundle] Added the support of the the logging context in the template
410b3e0 [HttpKernel] Added the context in the LoggerInterface
Discussion
----------
context in the LoggerInterface
This adds the context in the LoggerInterface. The change is totally BC for people using the logger. However this affects people implementing the interface.
Note that this require Seldaek/monolog#33 for the implementation
---------------------------------------------------------------------------
by Seldaek at 2011/06/17 04:24:18 -0700
@fabpot: just ping me when you are merging this one, so I can merge in monolog and we avoid out-of-sync issues.
---------------------------------------------------------------------------
by stof at 2011/06/17 04:49:05 -0700
@Seldaek you can merge in Monolog when you want. Monolog is BC so merging it before the PR in Symfony2 does not break things.
---------------------------------------------------------------------------
by Seldaek at 2011/06/17 05:08:34 -0700
Ah right, I thought the interfaces wouldn't match, but PHP allows extra args it seems so I'll merge right now.
---------------------------------------------------------------------------
by stof at 2011/06/17 05:32:58 -0700
PHP allows extra *optionnal* args and it is the case here :)
---------------------------------------------------------------------------
by Seldaek at 2011/06/17 05:35:00 -0700
Well yes otherwise you break the interface. Anyway it's merged so @fabpot, anytime :)
Commits
-------
edf4b87 Add missing "tearDown" functions, and some missing variable declaration (this saves for me almost 20MB when run all tests) Force AsseticBundle tests to use TestCase Fix test for DoctrineBundle to use TestCase
2b0c352 Increase code coverage for: YamlParser, Validators, PhpEngine + Helpers, HttpFoundation
b88a0a0 Remove tabs
99f9337 Additional tests for PhpEngine + Helpers More tests for UrlValidator
450ed85 Additional tests for DateTimeValidator, EmailValidator and UrlValidator
Discussion
----------
[Tests] Cleanup + make code coverage more happy
Hey,
this PR is a bit bigger than usually ;-) few infos what's inside:
- Fix `DoctrineBundle` test to use `TestCase`
- Mark tests as "incomplete" instead of commenting them out
- Increase code coverage for: `Validators`, `PhpEngine` + `Helpers`, `HttpFoundation` (`Session`, `Response` etc.)
- And my favourite ;-) added missing variables definition (also removed non-used) and `tearDown()` function (if needed) to tests which allowed me saved __~15MB__ when running all tests
---------------------------------------------------------------------------
by stloyd at 2011/06/16 05:58:21 -0700
@fabpot & @marcw It was rebased and cleanup up (I split up `AsseticBundle` symfony/AsseticBundle#1 change to new repo), and added few new tests.
Commits
-------
6436da2 added quote
7dc4e24 [Tests][Locale] locale supported INTL_ICU_VERSION, use ReflectionExtension to find ICU version
Discussion
----------
[Tests][Locale] locale supported INTL_ICU_VERSION, use ReflectionExtension to find ICU version
---------------------------------------------------------------------------
by igorw at 2011/06/16 03:44:25 -0700
Nice.
`INTL_ICU_VERSION` is PHP 5.4 only, right?
Also, it may be possible to use:
$output = \ReflectionExtension::export('intl', true);
That way we can get rid of the output buffering.
---------------------------------------------------------------------------
by stloyd at 2011/06/16 03:49:22 -0700
@igorw It will be added in PHP 5.3.7 to.
---------------------------------------------------------------------------
by stealth35 at 2011/06/16 04:04:09 -0700
@igorw no export don't return the info table
Commits
-------
72c074a [Session] Used \Locale::setDefault() when the locale is setted
Discussion
----------
[Session] Used \Locale::setDefault() when the locale is setted
For `DateType` in form component (by example), `\Locale::getDefault()` is used to displayed the name of months.
If `\Locale` class is not used when the locale is setted in the session, the name of months is not in a good language.
This PR solves this problem.
---------------------------------------------------------------------------
by pborreli at 2011/05/29 09:13:44 -0700
what if user doesn't have intl extension ?
---------------------------------------------------------------------------
by stof at 2011/05/29 09:24:04 -0700
You should wrap the calls to ``\Locale::setDefault`` in a ``class_exist`` check to avoid issue when using the stub implementation (for which calling ``setDefault`` is forbidden).
---------------------------------------------------------------------------
by francisbesset at 2011/05/29 09:26:40 -0700
@pborreli: Symfony have a fake Locale class and this class is used only if the server haven't intl enabled.
---------------------------------------------------------------------------
by stof at 2011/05/29 09:33:16 -0700
@francisbesset Yeah, but ``setDefault`` throw a ``BadMethodCall`` exception.
and so the check has to use ``extension_loaded`` instead of ``class_exists``.
---------------------------------------------------------------------------
by fabpot at 2011/06/13 10:12:15 -0700
Ticket #1121 is related to this PR.
---------------------------------------------------------------------------
by fabpot at 2011/06/15 06:18:28 -0700
I have just tried another implementation where the locale is passed as an argument to the built-in types and some data transformers (via a `LocaleAwareInterface` interface). That works fine as forms are immutable now, but the solution is obviously more "complex" as we need to pass the locale to many different classes. Also, using `Locale::setDefault()` has an advantage over my method: you can change the locale whenever you want within a PHP process (which can be useful even if this is an edge case). Last, but not the least, if make sense to update the PHP Locale to the user locale.
So, to sum up, this patch is probably the best solution (easy and flexible enough).
Commits
-------
e8326aa Renamed attributes to attr to be consistent with templating.
c707467 Added support for additional attributes in Form types that list field as their parent.
Discussion
----------
[Form] Added support for additional attributes
Added support for additional attributes in Form types that list field as their parent.
This is needed particularity for html5 data and data- attributes support, unfortunately $options['data'] is already taken, so adding a general $options['attributes'] is the easiest solution without breaking BC.
Now I know that this will be tempting for some to stuck style and class attributes here also, but I'd rather not restrict the keys that are passed in.
---------------------------------------------------------------------------
by Seldaek at 2011/05/22 14:51:02 -0700
Maybe it should be called attr for consistency with the template stuff, or the other should be renamed attributes. Other than that, I'm +1, data-* attributes are awesome, and abusers will find ways to abuse things either way.
---------------------------------------------------------------------------
by mvrhov at 2011/05/22 21:48:01 -0700
Naming it attr also crossed my mind when I was signing off yesterday.
Along with the possibility to go the way xml attributes are handled when node is converted to/from array.
So every option with @ prefix would automatically become html attribute. However going the latter path, it'd be harder to implement.
---------------------------------------------------------------------------
by fabpot at 2011/06/13 07:43:52 -0700
Can you give an example of a real-world use case? Thanks.
---------------------------------------------------------------------------
by Seldaek at 2011/06/13 07:54:51 -0700
You can use `array('attr' => array('data-foo' => 'bar'))`, which will output `data-foo="bar"`, which can be read easily by jQuery for example as `$('el').data('foo')`. It's a standard compliant and elegant way to pass extra data needed by the JS code along with DOM nodes, without polluting everything with script tags and all.
---------------------------------------------------------------------------
by fabpot at 2011/06/13 08:01:08 -0700
@Seldaek: I understand that. But why not doing this in the template?
---------------------------------------------------------------------------
by Seldaek at 2011/06/13 08:04:10 -0700
Well, I agree it most likely belongs in the template, but it's kind of data stuff that is not directly impacting the display rules of the element, so in some cases having the possibility to set that from the php code might be useful. Anyway I'll let @mvrhov answer maybe he had a more concrete use case. I just think it's nice to leave the door open, but I don't really need it.
---------------------------------------------------------------------------
by mvrhov at 2011/06/13 10:27:03 -0700
A bit late to the party. Ok, here is my use-case.
I have a pretty large form where part of the data is of tabular form. The number of rows is almost every time a lot larger than the number of columns
So I can either output a lot of text inputs filled with data and make already a large form intimidating. Or I can use a grid that supports editing. So I serialize that tabular data as json and put it as a value into one hidden field. Somehow I also have to get the column definitions to that grid. I decided to I serialize it and put it inside data-* attribute. Putting it into another hidden field doesn't make sense as when data is submitted back I don't need the column definitions as only the number of rows changes.
---------------------------------------------------------------------------
by fabpot at 2011/06/13 10:44:58 -0700
@mvrhov: ok, but what prevents you from doing this in the template directly?
---------------------------------------------------------------------------
by mvrhov at 2011/06/13 11:22:53 -0700
I have to get it into the view somehow. What I'd really not like to do is, iterate through that data in a controller and then pass it as another template variable.
---------------------------------------------------------------------------
by fabpot at 2011/06/14 00:10:22 -0700
But the controller is where you prepare the data that you want to send to the view. Without any concrete example, I'm going to close this PR.
---------------------------------------------------------------------------
by mvrhov at 2011/06/14 01:21:10 -0700
IMHO this has to go out through form as this is the part of the form also I do have a very slim controllers in this case 10 LOC, where half of them is just setting up an view data..
Nonetheless I went looking again very closely at the AbstractType and I do have buildView function available which I can override and set the column data I need there, and then provide custom view for that, so at least from this part this is an non issue.
With this PR all default form attributes can be set from outside and when searching for a good use-case I have found out that @henrikbjorn has implemented this via extensions [1], maybe he has a good use-case for this.
[1] - https://github.com/Comways/ComwaysFormExtraBundle/blob/master/Form/Extension/FieldTypeExtension.php
---------------------------------------------------------------------------
by henrikbjorn at 2011/06/14 01:48:53 -0700
Convenience is the only use case
---------------------------------------------------------------------------
by stof at 2011/06/14 02:08:09 -0700
@fabpot The issue is that passing it from the controller as another template variable makes it really hard when you use the type twice with different values. Passing them from the form would be the easiest way
---------------------------------------------------------------------------
by shuogawa at 2011/06/14 19:37:50 -0700
hello. thanks for great form library.
I want to support two ways to display additional attributes for form elements.
1) control in template like
{{ form_row(form.name, { 'width': '30' }) }}
2) control from php
$builder->add('name', 'text', array('attr'=>array('width'=>'30')));
If form elements configure by end user like cms,
and form elements dynamically change.
The second method is useful.
template designer can write {{form_row(form)}}
but
template designer can not write {{form_row(form.name), { 'width': '30' }}}
Thank you
---------------------------------------------------------------------------
by fabpot at 2011/06/14 23:01:18 -0700
@shuogawa: That's what I fear. Setting the `width` or any other attribute in PHP is wrong. This belongs to the templates.
---------------------------------------------------------------------------
by stloyd at 2011/06/15 00:09:05 -0700
@fabpot Then maybe just restrict allowed tags to `data-*` and don't use `attr` but some other not confusing name ? Just like we do with i.e. `maxlength`.
---------------------------------------------------------------------------
by fabpot at 2011/06/15 04:44:25 -0700
I'm going to merge it as a "convenience" tool, but the documentation should clearly state that the only usage should be for `data-*` attributes.
Commits
-------
07fa82d [Form] Revert changes impacting perfomance and readability
b709551 [Order] Make Form::types and FormView::types use the same order (Parent > Child)
e56dad6 [Form] simplify the code
bdd755e [Form] Fix the exception message when no block is found
c68c511 [Form] Make theming form prototypes consistent (start by looking for a '_<id>_<section>' block)
9ec9960 [Form] Simplify the code
4e3e276 [Form] Make the prototype view child of the collection view
Discussion
----------
[Form] Make the prototype view child of the collection view
This PR should be a base for discussion.
The [current implementation](https://github.com/symfony/symfony/pull/1188) has some drawbacks because the prototype view is not a child of the collection view:
* The 'multipart' attribute is not propagated from the prototype to the collection,
* The prototype view do not use the theme from the collection.
Those 2 points are fixed by the proposed implementation and one more benefit is that the template markup might be easier to work with:
before:
```html
<div id="form_emails">
<div>
<label for="form_emails_0">0</label>
<input type="email" id="form_emails_0" name="form[emails][0]" value="a@b.com">
</div>
<script type="text/html" id="form_emails_prototype">
<div>
<label for="$$name$$">$$name$$</label>
<input type="email" id="$$name$$" name="$$name$$" value="" />
</div>
</script>
</div>
```
after:
```html
<div id="form_emails">
<div>
<label for="form_emails_0">0</label>
<input type="email" id="form_emails_0" name="form[emails][0]" value="a@b.com">
</div>
<script type="text/html" id="form_emails_prototype">
<div>
<label for="form_emails_$$name$$">$$name$$</label>
<input type="email" id="form_emails_$$name$$" name="form[emails][$$name$$]" value="" />
</div>
</script>
</div>
```
@kriswallsmith I'd like to get your feedback on this PR. thanks.
---------------------------------------------------------------------------
by stof at 2011/06/14 07:01:01 -0700
@fabpot any ETA about merging it ? Using the prototype currently is a pain to build the name. The change makes it far easier
---------------------------------------------------------------------------
by fabpot at 2011/06/14 07:09:46 -0700
The templates are much better but I'm a bit concerned that we need to add the logic into the Form class directly. That looks quite ugly. If there is no other way, I will merge it.
---------------------------------------------------------------------------
by vicb at 2011/06/14 07:14:32 -0700
I have found no better way... I am testing some minor tweaks I want to submit.
---------------------------------------------------------------------------
by kriswallsmith at 2011/06/14 07:34:25 -0700
I'm not happy with the code in Form.php either... would creating a PrototypeType accomplish the same thing?
---------------------------------------------------------------------------
by vicb at 2011/06/14 07:42:07 -0700
@kriswallsmith tried and dismissed, the id and name are bad & you have to go for `render_widget(form.get('proto'))` in the template. That should be fixeable but not any better.
---------------------------------------------------------------------------
by kriswallsmith at 2011/06/14 07:45:21 -0700
What do you mean the id and name are bad? If we have a distinct type for the prototype, can't we do whatever we want using buildView() and the template?
---------------------------------------------------------------------------
by vicb at 2011/06/14 07:53:31 -0700
@kriswallsmith the id would be smthg like `form_emails_$$name$$_prototype` but yes we should be able to do whatever we want but the code might end up being more complex.
I am done with the tweaks but still open to feedback on this PR.
---------------------------------------------------------------------------
by kriswallsmith at 2011/06/14 08:08:21 -0700
Yes, that is the type of name I would expect.
---------------------------------------------------------------------------
by kriswallsmith at 2011/06/14 08:08:33 -0700
Oops -- I mean id.
---------------------------------------------------------------------------
by kriswallsmith at 2011/06/14 08:09:42 -0700
Maybe I'm confused what id you're referring to. I'll try to spend some time on this today.
---------------------------------------------------------------------------
by vicb at 2011/06/14 08:23:56 -0700
That should be the id of the `<input>`, the id of the script would be `form_emails_$$name$$_prototype_prototype` (if prototype is the name of the nested node).
I am trying to setup a branch with my code (playing with git & netbeans local history)
---------------------------------------------------------------------------
by vicb at 2011/06/14 08:46:25 -0700
@kriswallsmith https://github.com/vicb/symfony/tree/kris/proto if that can help (there are still changes in Form.php)
---------------------------------------------------------------------------
by kriswallsmith at 2011/06/14 08:47:08 -0700
Thanks, I'll take a look.
---------------------------------------------------------------------------
by vicb at 2011/06/15 00:48:38 -0700
I would have expected it to be faster however `array_map` is about twice slower... reverted !
Commits
-------
9d6357c [HttpFoundation] Document the changes to the File classes
136b80a [HttFoundation] Add File::getExtension() as \SplFileInfo::getExtension() was introduced in PHP 5.3.6
38b3b74 [HttpKernel] Fix and test previous commit
ac0c00c [HttpFoundation] Make File extends \SplFileInfo
Discussion
----------
[HttpFoundation] Make File extends \SplFileInfo
This is a rebased version of [PR 674](https://github.com/symfony/symfony/pull/674).
* File: The API has changed (now extends \SplFileInfo),
* File: move() creates the target directory when it does not exist
* UploadedFile: introduction of getClientXXX() methods (for Size, OriginalName, MimeType)
If this PR does not get merged UploadedFile should at least be fixed: [Client.php](https://github.com/symfony/symfony/blob/master/src/Symfony/Component/HttpKernel/Client.php#L124) relies on a last parameter which is no more defined and which is used to bypass [move_uploaded_file()](https://github.com/symfony/symfony/blob/master/src/Symfony/Component/HttpFoundation/File/UploadedFile.php#L155) in test mode.
If this could be merged, I'll detail the changes in UPDATE.md
---------------------------------------------------------------------------
by fabpot at 2011/06/14 08:20:59 -0700
I'll merge it. Can you update the UPDATE file?
---------------------------------------------------------------------------
by vicb at 2011/06/14 09:24:01 -0700
done
# Commits
ca52a04 [Validator] Allow DateTime objects as valid Times
# Discussion
## [Validator] Allow DateTime objects as valid Times
Also added tests for `DateTime` objects as valid on `Date` and `Time` constraints.
I didn't include the test for the `DateTime` constraint, as it's already included in this PR:
https://github.com/symfony/symfony/pull/1085
---------------------------------------------------------------------------
## fabpot @ 2011/06/09 09:07:21 -0700
I don't think it makes sense to use a \DateTime instance to represent a Time.
---------------------------------------------------------------------------
## ajessu @ 2011/06/09 09:33:20 -0700
If I have an entity with a doctrine type `Time`:
Time (DateTime instance where only H:i:s get persisted)
```php
<?php
/**
* @ORM\Column(type="time")
* @Assert\Time()
*/
protected $startTime;
```
and I create a form out of this Entity, a `DateTime` object is passed when the form is submitted.
This generates an `UnexpectedTypeException`.
I just made this change to match the `Date` validator with the doctrine type `Date`, which also shares this behavior:
https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Validator/Constraints/DateValidator.php#L28
Date (DateTime instance where only Y-m-d get persisted)
Rules are as follows:
* If multiple is true, then the empty_value is ignored
* If not, and if the field is not required, the empty_value is set to the empty string by default and displayed
* If the field is required, and if the user explicitely set the empty_value, then it is displayed
* kriswallsmith/form/collection-proto:
added script[type="text/html"] collection prototype to form themes
[Form] removed collection prototype from form tree
This reverts commit d044498cde.
The reason for reverting is that the name is actually used to customize
the template on a per field basis:
{% block _post_excerpt_widget %}
***{{ block('text_widget') }}***
{% endblock %}
Here, post is the name of the Type.
* kriswallsmith/form/lazier-csrf-token:
[Form] fixed xpath
[Form] moved csrf listener to its own class
fix issue with csrf token not present on collection fields because of resize listener
* lsmith77/serializer_tweaks: (22 commits)
clarified that BC is broken in the Serializer component
added UPDATE notes for Serializer component changes
fix tests
marked public api
more encoder lazy loading tweaks
always use getEncoder() to enable lazy loading
cosmetic tweak
removed setEncoder/removeEncoder/addNormalizer/removeNormalizer
SerializerAwareInterface and DecoderInterface do not implement EncoderInterface anymore
handle non objects
moved the methods that can later be moved to a Builder to the bottom
use getEncoder inside encode/decode
made serialize/deserialize/encode/decode final
added Constructor
added Exception's from SerializerBundle
made (de)normalizeObject() private
renamed hasEncoder/hasDecoder to supportsSerialization/supportsDeserialization
notice fixes
typo fixes
all encoders implement EncoderInterface
...
The current implementation is not ready for inclusion in 2.0. It has several
known problems (security, not possible to disable it, not "cloud-compatible",
...) and it's not a must have feature anyway.
Some references:
* Security issue in FileType: https://github.com/symfony/symfony/issues/1001
* Validation fails on file, still stored in TemporaryStorage: https://github.com/symfony/symfony/issues/908
* Add a size argument & ability to configure TemporaryStorage: https://github.com/symfony/symfony/pull/748
This feature should be reworked and discussed for inclusion in 2.1.
* fivestar/single-choice-expanded:
[Form] Fixed FixRadioInputListener to not ignore 0.
[Form] Fixed single expanded choice type to set checked attribute when passed boolean value
* vicb/form-rendering-fix:
[Form] Fix accessibility for file inputs
[FrameworkBundle] Fix the FormHelper phpDoc
[FrameworkBundle][Form] Add some phpDoc for the FormHelper class
[FrameworkBundle][Form] Fix label rendering
[FrameworkBundle][Form] Fix rendering search inputs in PHP
[Form] FormType labels should never have a for attribute
[Form] Never render a view again
* The command names have now full support for nested namespaces. It means
that abbreviations work for each sub-namespace:
./app/console doctrine:mapping:info
# worked before
./app/console doctrine:map:in
# works now
./app/console doc:map:in
* Aliases are now first class citizen. They can have their own namespace,
like the main name. So, now, there is no difference between an alias and a
name.
* As names and aliases can be namespaced, the Command::getFullName() and
Command::getNamespace() method have been removed.
* gordonslondon/http-foundation/response:
[HttpFoundation] merge Response::isRedirected() with Response::isRedirect() - Response::isRedirected() has been removed
If some of the nested views are rendered individually they should not be rendered again when calling form_rest.
A typical would be when some nested file views are rendered, form_rest should not render them again.
It is still possible to render a label once the widget has been rendered. This is for checkboxes and radios
where the widget is typically rendered before the label.
* Tests to check if the pattern option is handled correctly by DateType
* Tests to check if the pattern parameter is handled correctly by DateTimeToLocalizedStringTransformer
* vicb/form-rendering:
[Form] The variable stack should not persist between section rendering (fixes#1157)
[Twig][Form] Tweak form extension phpDoc and code
[Form] Tweak phpDoc
[FormView] fix phpDoc
[Form] Some tweaks
* Seldaek/events:
[EventDispatcher] Removed temporary code
[FrameworkBundle] Improved code readability
[FrameworkBundle] Clarified code and fixed regression
Update Core and Security events to latest model
[EventDispatcher] Allow registration of arbitrary callbacks
[EventDispatcher] Remove useless code
[EventDispatcher] Minor memory optimization to getListeners()
[FrameworkBundle] Small optimization, remove some function calls
* CodeMeme/1058-fix-radio-input-listener:
Fix for RadioInputListener's empty value erroneously becoming extra data Refs #1058
Added test for RadioInputListener bug treating no data as extra data
* stloyd/validators_refactoring:
Refactor validators constraints: - remove need for defining "getTargets()" method as 95% of validators use same one - replace abstract "Constraint::getTargets()" with one that use 95% of validators - add additional tests for "Constraint::getTargets()" method - remove unused "use" statement in Constraint\Valid
The main benefit is that in XML/YML files we have common syntax (i.e. core.controller, form.pre_bind) that properly namespaces event names (before: onCoreController was ok, preBind was not).
On the other hand in PHP land we also have namespaced events, CoreEvents::controller, FormEvents::preBind, before it was Events::onCoreController, Events::onPreBind, we now have more context.
This in effect removes the direct link between event name and the method name on the handler.
Any callback can be given as a handler and the event name becomes an arbitrary string. Allowing for easier namespacing (see next commit)
- remove need for defining "getTargets()" method as 95% of validators use same one
- replace abstract "Constraint::getTargets()" with one that use 95% of validators
- add additional tests for "Constraint::getTargets()" method
- remove unused "use" statement in Constraint\Valid
The current code was broken when a style was defined inline:
<bg=black>Foo</bg=black>
When creatin a new style formatter, it's better to let the formatter
apply the style to the text.
* bschussek/form: (22 commits)
Fix merge error (function "guess" was in there twice)
[Form] Added test case for bf2f9d2a02
[Form] Form::isBound() and Form::isValid() work correctly now for read-only forms
[Locale] Improved error reporting and added stubs for intl_is_failure(), intl_get_error_code() and intl_get_error_message()
[Form] Implemented fix for 361c67f54f
[Form] Add test for the handling of array values in the constraint violation
[Form] Further simplified PropertyPath code
[Form] Added test for 6c337d1cc0
[Form] Removed unused option "pattern" of date and time type
[Form] Renamed view variable "name" to "full_name"
[Form] Renamed collection option "type_options" to "options" to be consistent with the repeated type
[Form] CSRF documentation and a few CS changes
[Form] Move CSRF options from types to the CSRF extension
[Form] Added a search form field type
[Form] Optimization of PropertyPath
[Form] replace assertEquals by assertFalse, assertTrue, assertNull
[Form] fix file permissions to 644 again ;)
[Form] add tests for type_options in collectionType
fix file permissions to 644
[Form] add type_options for CollectionType to be abble to set options to type
...
This type of override is supported by MS MVC3 and is recommended by Google.
Also added ability to override request method via ?_method= when
request is made via GET.
* alexandresalome/feat-routing-exceptions:
[Routing] Fix the exception inheritance + Add the LICENCE block in new files
[Routing] Change the Exception namespacing + base class for every exception + update PHPDoc
[Routing] Add specific exceptions for the UrlGenerator
* stloyd/ipvalidator_fix:
Better comment about no test IP6 addresses for "FILTER_FLAG_NO_RES_RANGE"
Refactoring of IpValidator to use native php filter extension, also adding additional flag support and test cover.
When generating URL, thrown exceptions are InvalidArgumentException and
distinction of errors is quite difficult. This modification brings different
exceptions for different cases
encoding is detected using the `mb_detect_encoding()`-function
in strict-mode. Checking is done before the parsing starts.
Without this patch, the calls to `preg_replace()` using the
'u'-modifier would cause the non-utf8-string being processed
to be empty when parsing starts which makes the parsing return
no result.
* schmittjoh/security:
[HttpFoundation] fixed php doc
updated UPDATE file
[Security] use deep flag when retrieving username + password
[HttpFoundation] added $deep flag to Request::get()
[HttpFoundation] removed getDeep(), added a boolean flag to get() instead
* schmittjoh/security:
[HttpFoundation] added unit test
[Security][HttpFoundation] splits Request::hasSession() into hasSession(), and hasPreviousSession()
[SecurityBundle] added some tests
add provider to configuration
update DI to handle change in config and another provider
separate dbal specific acl config
add provider to configuration
update DI to handle change in config and another provider
separate dbal specific acl config
* bschussek/form:
[Form] CSRF fields are not included in the children of a FormView anymore if the view is not the root
[Form] FormView::offsetUnset() is now supported. It was possible anyway using getChildren() and setChildren().
[Form] Split the option "modifiable" of the "collection" type into "allow_add" and "allow_delete"
[Form] Added test for last commit by kriswallsmith and improved dealing with original names
[Form] Fixed variable scope when entering nested form helpers
[Form] Added tests for blocks/templates in the format _<ID>_(widget|row|label|...)
[Form] updated listener to check that data is an array
The form component should now guarantee to always pass an UploadedFile object to your model. There you can call getOriginalName() to retrieve the original name of the uploaded file. For security reasons, the real file name is a generated hash value.
The consequence of this commit is that variables are accessible that have been passed to a surrounding form helper.
Example template:
{% block my_widget_label %}
<label>{{ label }}
{% endblock %}
{% block my_widget_row %}
{# It is not necessary to explicitely pass through the label variable #}
{{ form_label(form) }}
{{ form_widget(form) }}
{% endblock %}
Example usage:
{{ form_row(form.mywidget, { 'label': 'My Widget' }) }}
* kriswallsmith/kernel/bundle-extension:
[HttpKernel] added check of default extension alias convention
[AsseticBundle] coding standard and comment tweaks
[HttpKernel] added BundleInterface::getContainerExtension() which is implicitly loaded
* Brouznouf/patch-2:
[Serializer] [XmlEncoder] Add unit test for decoding / encoding root with attributes
[Seriliazer] [XmlEncoder] Optimize conditions
[Serializer] [XmlEncoder] Allow decoder to extract attributes in root element
This has been removed for several reasons:
* the framework does not know where the document root is and should not care
* as the document root was static, it was impossible to have several document roots depending on some business rules (see next one)
* sometimes, the document root is not under the web root directory (so the logic of getWebPath() is not always correct)
* the feature was not used anywhere in the core
* igorw/ipv6:
[HttpFoundation] minor optimization
minor adjustments suggested by vicb
[HttpFoundation] IPv6 support for RequestMatcher
[HttpFoundation] refactor RequestMatcherTest to use dataProvider
[Validator] use full iPv6 regex
[Validator] add IPv6 support to UrlValidator
[HttpFoundation] add IPv6 support to Request
[HttpFoundation] test Request::create with an IP as host name
[HttpFoundation] refactor Request::getClientIp test
* dustinwhittle/master:
[Classloader] Added phpdoc with example usage + refactored unit tests fixtures
[Classloader] Refactored ApcUniversalClassLoader to use setUp() to detect APC
[Classloader] Fixed typo + coding standards in ApcUniversalClassLoader test
[Classloader] Fixed APC class loader + added unit tests
* bschussek/form:
[Form] Automatically setting "data_class" option if objects are passed at the creation of a form
[Form] Improved the way passed data is handled in FormFactory
[Form] Simplified FileType code
[HttpFoundation] TemporaryStorage automatically creates the directory if it doesn't exist yet
[Form] Changed FormBuilder::build() to FormBuilder::create(). You hvae to pass the resulting builder to FormBuilder::add() manually now
[Form] Added FieldTypeValidatorExtension and fixed FQCN of DelegatingValidator
* bschussek/form-extensions:
[Form] Refactored code from CoreExtension to new ValidatorExtension
[Form] Added FormTypeExtensionInterface
[Form] Reorganized code into "form extensions"
With implementations of this interface, existing types can be amended.
The Csrf extension, for example, now contains a class FormTypeCsrfExtension
that adds CSRF capabilities to the "form" type.
To register new type extensions in the DIC, tag them with "form.type_extension"
and the name of the extended type as alias.
The extension classes are now the only constructor argument of the FormFactory class. They replace the existing "type loader" classes.
new FormFactory(array(
new CoreExtension($validator, $storage),
new CsrfExtension($csrfProvider),
new DoctrineOrmExtension($em),
));
Together with a few upcoming commits this mechanism will make
* extension of the form framework in bundles and
* usage of the forms outside of Symfony2
much easier.
* lsmith77/request_format_tweaks:
added text/html to default format mapping
return "q" from splitHttpAcceptHeader() to enable more complex accept header negotiations
added support for setting a custom default format in Request::getRequestFormat()
The data can now be passed to all creation methods:
$form = $factory->create('form', $data);
By default, a form will receive the name of its type ("form" in above example). If you wish to pass a custom name, use createNamed():
$form = $factory->createNamed('form', 'myform', $data);
* form: (291 commits)
[FrameworkBundle] updated method call
[Form] Removing excess option in the TimezoneType
[FrameworkBundle] Adding check for invalid form type for better exception message
[TwigBundle] Removing dbug text in form template
[Form] Removed obsolete code in TextType
[Form] fixed translations escaping
[Form] Adding a check that the choice_list option on the ChoiceType implements the ChoiceListInterface.
[Form] added support for groups in form validation (when using array data)
[Form] fixed error bubbling for choices when expanded is true
[Form] added a unit test
[Form] Removed obsolete view variables
[Form] Renamed ChoiceUtil to FormUtil and gave its methods more general names
[Form] Changed separator for Twig blocks from double underscore to single underscore to match the PHP template separator
[Form] Removed StripTagsListenerTest
[Form] Removed StripTagsListener. Its implementation is insufficient and needs to be replaced by a better one.
[Form] added a way to specify the form constraint when building the form (useful if you work with arrays instead of objects)
[Form] Added test for 'email' type and fixed a few bugs
[Form] Removed obsolete constraints from validation.xml
Revert "[Form] removed validation.xml file (not used anymore)"
Added html5 email input to the forms
...
* schmittjoh/referenceValidation:
[DependencyInjection] also check references of inlined services
[DependencyInjection] adds emulation of "exception-on-invalid-reference" behavior
* kriswallsmith/dic/method-renames:
added method renames to UPDATE
[DependencyInjection] renamed ContainerBuilder::remove() as removeDefinition() to be more consistent with other definition-related methods
[DependencyInjection] renamed Definition::setArgument() as replaceArgument() to be more specific
The _scheme requirement can be used to force routes to always match one given scheme
and to always be generated with the given scheme.
So, if _scheme is set to https, URL generation will force an absolute URL if the
current scheme is http. And if you request the URL with http, you will be redirected
to the https URL.
[Form] Fixed {get,set,has}Var references in templating php
[Form] Added getVars to FormView to ease usage in Twig. Also added some phpdoc and cleaned up the get method by adding a default value
[Form] Fix
[Form] Delete file generated by test
Based on dfb93b1bcebf1f34d3a880d00f36acb2bcca0f08:
[FORM] Fixed DateField Month Choices
The month choices were calculated using the current day of the month with
gmmktime rather than the 1st of the month. Additionally, this provides a
UTC timestamp which is passed to the formatter (IntlDateFormatter) which
converts the timestamp using the current timezone. This means that the UTC
timestamp for 1st March was being converted for my timezone (EST) and giving
a date of 28th February, leading to Feb appearing again in the popup form
instead of Mar.
* hason/logicalname:
[Templating] changed __toString method (synonym for getLogicalName method)
[Templating] fixed phpdoc a test
[FrameworkBundle] added getLogicalName() method to TemplateReference
[Templating] added method to return the template logical name, added test