Commit Graph

117 Commits

Author SHA1 Message Date
Bernhard Schussek 69e5e58629 [Form] Individual rows of CollectionType cannot be styled anymore for performance reasons 2012-07-14 12:10:29 +02:00
Bernhard Schussek cd7835d8d2 [Form] Cached the form type hierarchy in order to improve performance 2012-07-13 20:39:30 +02:00
Bernhard Schussek a92f80b815 [Validator] Added Length constraint and deprecated MinLength and MaxLength 2012-07-11 19:48:02 +02:00
Bernhard Schussek 83a3f75b2d [Validator] Deprecated the constraints Min and Max in favor of Range 2012-07-11 19:48:02 +02:00
Bernhard Schussek 0be602deef [Validator] Deprecated the Size constraint 2012-07-11 15:48:36 +02:00
Fabien Potencier f3547d4ff1 merged branch bschussek/testfix (PR #4847)
Commits
-------

7a76dba [Form] Renamed the options "data_timezone" and "user_timezone"
655d645 [Form] Fixed tests failing on systems with timezones other than +01:00

Discussion
----------

[Form] Fixed tests and renamed the options "data_timezone" and "user_timezone"

Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: -
Todo: -

The option names were renamed for better consistency with the terms "model data" or "model format" and "view data" or "view format".
2012-07-11 09:47:34 +02:00
Bernhard Schussek 7a76dbad20 [Form] Renamed the options "data_timezone" and "user_timezone" 2012-07-11 09:44:09 +02:00
Fabien Potencier 5da1bc6a4f added missing listener priority changes in the UPGRADE file (refs #2680) 2012-07-11 09:36:00 +02:00
Bernhard Schussek 7727de73e5 [Form] Deprecated Form::bindRequest() and replaced it by a PRE_BIND listener 2012-07-09 20:34:45 +02:00
Bernhard Schussek c0a520792b [Form] Prevented duplicate validation of form constraints 2012-07-09 19:28:39 +02:00
Michaël Perrin 81eb7222d2 Simpler sentence concerning upgrade of the form_label function 2012-07-09 18:15:43 +03:00
Michaël Perrin f6f1bb5e02 Update to the "Upgrade to v2.1" documentation: the way HTML attributes are passed for the `form_label` function has changed. 2012-07-09 17:14:03 +02:00
Fabien Potencier d6d1d91766 fixed markup 2012-07-09 14:19:00 +02:00
Bernhard Schussek c09bad8aea [Form] Clarified how to adapt forms that inherited from FieldType for Symfony 2.1 2012-07-06 19:15:07 +02:00
Frédéric Hardy 615558394a Remove bug in locale management in listener. 2012-07-03 16:15:48 +02:00
Fabien Potencier 81fe2ff8e2 merged branch fabpot/locale-listener (PR #4692)
Commits
-------

88caf3a [HttpKernel] removed the storage of the current locale in the session

Discussion
----------

[HttpKernel] removed the storage of the current locale in the session

Before this commit, the current locale was stored in the session (if one
was already started). That way, for the next requests, even if the
request locale attribute was not set, the locale was "restored".

But this is a really bad practice as it means that the same URL can have
a different content depending on the previous requests. It would have
been better if the Vary header was set but the locale can be different
from the value coming from the Accept-Language anyway.

This is a BC break but fortunately, you can restore the 2.0 behavior by
creating a simple event listener that contains the logic removed by this
commit.

---------------------------------------------------------------------------

by travisbot at 2012-07-01T06:56:48Z

This pull request [fails](http://travis-ci.org/symfony/symfony/builds/1748659) (merged 009e30f0 into 2e356c1a).

---------------------------------------------------------------------------

by schmittjoh at 2012-07-01T08:15:46Z

How about using a cookie instead? It would remove the BC break, and also be possible to use a vary header?

---------------------------------------------------------------------------

by fabpot at 2012-07-01T09:13:44Z

The goal is to make Symfony as stateless as possible; introducing a cookie would defeat this goal.

---------------------------------------------------------------------------

by drak at 2012-07-01T09:19:37Z

@fabpot - thank you for bringing this to attention. I was meaning to do it a long time ago. The requested language is entirely a per request issue and must always be so. URLs must only ever return one content, and not multiple (e.g. different languages). The correct way to behave is to detect the language based on URL and failing that where a language is not requested, to look at the preferred language from the browser request and if available it can be redirected to that resource (e.g. /fr). This is what we do in Zikula. We have a further session based setting for "preferred language" which if set will override the browser default.

In summary:

1. If the language is specified in the GET request, return that language always. E.g. domain.com/fr/foo should return a French version of foo

2. If no language is specified in the GET request: first check the session for a preferred language, otherwise check the browser string for the preferred language and then if necessary, redirect to that resource. We have a setting which additionally say "always have language in URL, and don't put language code in URL for default language"

This means what in Zikula we only ever have one URL per language version of a page, but it still allows for users to set their preferred language which is taken in to account mainly when they visit the homepage (but in fact any page without a specific language in the request).

---------------------------------------------------------------------------

by drak at 2012-07-01T09:38:06Z

+1 on this PR. Basically the request locale should be in the Request object and calculated according to the applications preferences.

---------------------------------------------------------------------------

by schmittjoh at 2012-07-01T12:38:25Z

I agree that content must be detected based on the request, but I strongly disagree with relying entirely on the URL.

@fabpot, if you think about it using a cookie would still be stateless. There would be no state whatsoever, the detection would be entirely based on the request. Whether the language information is transmitted in the URL or as part of request headers is for the developer to decide eventually, at least IMO. My suggestion would just provide a default which is more BC.

---------------------------------------------------------------------------

by drak at 2012-07-01T20:08:50Z

@schmittjoh it's not entirely from the URL, there are browser preferences and also user defaults ca nalso available but the latter is slightly higher level. IMO it's not really Symfony's job here, it's application level specific. We have a pretty good working example of that in Zikula. Anyone can easily implement your own requirements with a listener.

What is absolutely clear however is it is wrong for one URL to deliver more than one version of any content.

---------------------------------------------------------------------------

by schmittjoh at 2012-07-01T21:16:52Z

I'm 100% for this change. My suggestion would just be more BC while still keeping Symfony2 stateless. Of course, it can be easily implemented in userland if we do not care about BC here.

Regarding different URLs per content, I do not think that this is our decision to make. Generally, developers should be able to make whatever content negotation they see fit. Whether they rely solely on the URL, or also take other request headers into account should not be limited by Symfony2.

---------------------------------------------------------------------------

by fabpot at 2012-07-02T10:37:26Z

I've added a paragraph in the UPGRADE file with a listener example that can be used to keep BC.
2012-07-02 12:37:57 +02:00
Fabien Potencier 88caf3a370 [HttpKernel] removed the storage of the current locale in the session
Before this commit, the current locale was stored in the session (if one
was already started). That way, for the next requests, even if the
request locale attribute was not set, the locale was "restored".

But this is a really bad practice as it means that the same URL can have
a different content depending on the previous requests. It would have
been better if the Vary header was set but the locale can be different
from the value coming from the Accept-Language anyway.

This is a BC break but fortunately, you can restore the 2.0 behavior by
creating a simple event listener that contains the logic removed by this
commit.
2012-07-02 12:36:25 +02:00
Fabien Potencier c0e4760b38 merged branch kriswallsmith/form/mv-humanize (PR #4645)
Commits
-------

c1e4166 moved create of default form label to view layer

Discussion
----------

move create of default form label to view layer

A small optimization if you provide custom labels in the view layer (i.e. `{{ form_label(form.name, 'Your name') }}`

```
Bug fix: no
Feature addition: no
Backwards compatibility break: yes
Symfony2 tests pass: yes
Fixes the following tickets: ~
Todo: ~
License of the code: MIT
Documentation PR: ~
```

---------------------------------------------------------------------------

by travisbot at 2012-06-24T14:45:17Z

This pull request [fails](http://travis-ci.org/symfony/symfony/builds/1694310) (merged 37f0b774 into 0d4b02e4).

---------------------------------------------------------------------------

by travisbot at 2012-06-24T15:03:44Z

This pull request [passes](http://travis-ci.org/symfony/symfony/builds/1694418) (merged c1e4166e into 0d4b02e4).
2012-07-01 22:38:07 +02:00
Kris Wallsmith c1e4166ead moved create of default form label to view layer 2012-06-24 07:57:42 -07:00
Javier Lopez 731545de06 Fixed type, from repeated twice 2012-06-22 13:22:20 +02:00
Julien Brochet dacd8aa5e3 tweaked UPGRADE file 2012-06-16 19:50:09 +03:00
Michel Salib be637b5c23 Add upgrade for commit 0995b1f28b 2012-06-13 02:33:21 +03:00
Fabien Potencier fc40e53724 Revert "merged branch jfsimon/issue-4475 (PR #4497)"
This reverts commit f8a09db5e2, reversing
changes made to ae2ec36e27.
2012-06-09 21:38:22 +02:00
Fabien Potencier f8a09db5e2 merged branch jfsimon/issue-4475 (PR #4497)
Commits
-------

06976fc Updated upgrade 2.1 file.
110ccd8 [BrowserKit] Updated changelog.
686854b [http kernel] Added client response type test.
ce7e1e6 [browser kit] Client now stores filtered response after request.

Discussion
----------

[browser kit] Client now stores filtered response after request.

Bug fix: yes
Feature addition: no
Backwards compatibility break: yes/no, choice is your
Symfony2 tests pass: yes

`Symfony\Component\HttpKernel\Client::request()` method now returns a `Symfony\Component\BrowserKit\Response` instance.

Fixes issue #4475.

---------------------------------------------------------------------------

by stof at 2012-06-05T08:58:00Z

This *is* as BC break as it changes the class returned by the method, even if the BC break is a bugfix to respect the epxected behavior :)

---------------------------------------------------------------------------

by jfsimon at 2012-06-05T09:05:32Z

@stof you're right!

---------------------------------------------------------------------------

by travisbot at 2012-06-06T15:29:54Z

This pull request [passes](http://travis-ci.org/symfony/symfony/builds/1533533) (merged 686854b2 into 1541fe26).

---------------------------------------------------------------------------

by stof at 2012-06-09T10:12:18Z

@jfsimon can you add a note in the changelog of the component and in the upgrade file ?

---------------------------------------------------------------------------

by jfsimon at 2012-06-09T10:51:00Z

@stof done!

---------------------------------------------------------------------------

by travisbot at 2012-06-09T11:12:43Z

This pull request [passes](http://travis-ci.org/symfony/symfony/builds/1575524) (merged 06976fcd into 1541fe26).

---------------------------------------------------------------------------

by stof at 2012-06-09T12:50:16Z

@fabpot 👍
2012-06-09 17:15:29 +02:00
Grégoire Paris f541a54770 [Form] implement force append / prepend 2012-06-09 17:05:41 +02:00
Jean-François Simon 06976fcd82 Updated upgrade 2.1 file. 2012-06-09 12:40:37 +02:00
Bernhard Schussek d6e80012b2 Fixed mistake in UPGRADE file 2012-06-01 07:59:14 +02:00
Jérémie Augustin 09e5f4629d fix markdown for code 2012-05-25 15:14:30 +03:00
Bernhard Schussek 94f6f7776a Restructured Form section of UPGRADE 2012-05-25 12:34:17 +02:00
Bernhard Schussek ee803cd948 [Form] Renamed setVars() to addVars() in FormViewInterface 2012-05-25 12:34:16 +02:00
Bernhard Schussek 2e6cdd15c5 [Form] Inverted the logic of "single_control" and renamed it to "compound". The opposite is now "simple". 2012-05-25 12:34:16 +02:00
Bernhard Schussek 98a7c0cf5f [Form] Consolidated FormInterface, FormBuilderInterface and FormViewInterface 2012-05-25 12:34:16 +02:00
Bernhard Schussek 8e128fc644 [Form][OptionsResolver] Fixed typos 2012-05-25 12:34:16 +02:00
Bernhard Schussek 877d8f7195 [Form] Reversed the order of $type and $name in FormFactory::createNamed[Builder]() 2012-05-25 12:34:16 +02:00
Bernhard Schussek 33fecca210 [Form] Merged various form events and added class FormEvent 2012-05-25 12:34:16 +02:00
Bernhard Schussek bec80157f9 [Form] Renamed client and application format to view and model format 2012-05-25 12:34:16 +02:00
Bernhard Schussek 8cae3282d8 [Form] setDefaultOptions() is now coded against OptionsResolverInterface 2012-05-25 12:34:16 +02:00
Bernhard Schussek 2cd99e80b6 [Form] Added FormBuilderInterface and FormViewInterface and cleaned up FormTypeInterface and FormTypeExtensionInterface 2012-05-25 12:28:17 +02:00
Bernhard Schussek 0ef4066983 [Form] Options are now passed to buildView() and buildViewBottomUp() 2012-05-25 12:28:17 +02:00
Bernhard Schussek 027259eba4 [Form] Changed getDefaultOptions() to setDefaultOptions(OptionsResolver $resolver) in FormTypeInterface 2012-05-25 12:28:17 +02:00
Bernhard Schussek 14225067eb [Form] Clarified the usage of "constraints" in the UPGRADE file 2012-05-22 11:22:27 +02:00
Bernhard Schussek af41a1a550 [Form] Fixed typos 2012-05-22 09:30:22 +02:00
Bernhard Schussek ac6939441f [Form] Allowed native framework errors to be mapped as well 2012-05-22 09:30:21 +02:00
Bernhard Schussek d0d1fe6182 [Form] Added more information to UPGRADE and CHANGELOG 2012-05-22 09:30:21 +02:00
Bernhard Schussek 081c6437e4 [Form] Updated UPGRADE and CHANGELOG 2012-05-22 09:30:21 +02:00
Bernhard Schussek 8f7e2f602c [Validator] Fixed: @Valid does not recurse the traversal of collections anymore by default 2012-05-22 09:29:53 +02:00
Bernhard Schussek 5e87dd885c [Form] Added tests for the case when "property_path" is null or false. Instead of setting "property_path" to false, you should set "mapped" to false instead. 2012-05-22 09:29:53 +02:00
Jakub Zalas 942cfc7a06 [Form] Removed index_generation mention from the UPGRADE instructions as the option no longer exists. 2012-05-08 13:56:34 +01:00
Albert Jessurum 251b93c8d9 Corrected typo on upgrade document 2012-05-06 13:34:55 +03:00
Bernhard Schussek d3bb4d085c [Form] Renamed option 'primitive' to 'single_control' 2012-04-27 10:18:25 +02:00