Commit Graph

149 Commits

Author SHA1 Message Date
Lukas Kahwe Smith 72bf93f1d9 typo fix in upgrading guide 2012-03-25 18:27:20 -03:00
Fabien Potencier 5041f85878 tweaked UPGRADE file 2012-03-23 18:01:12 +01:00
Fabien Potencier 09ab6430c0 merged branch drak/session_flashmessages (PR #3267)
Commits
-------

5ae76f1 [HttpFoundation] Update documentation.
910b5c7 [HttpFoudation] CS, more tests and some optimization.
b0466e8 [HttpFoundation] Refactored BC Session class methods.
84c2e3c [HttpFoundation] Allow flash messages to have multiple messages per type.

Discussion
----------

[2.1][HttpFoundation] Multiple session flash messages

Bug fix: no
Feature addition: yes
Backwards compatibility break: yes, but this already happened in #2583.  BC `Session` methods remain unbroken.
Symfony2 tests pass: yes
Fixes the following tickets: #1863
References the following tickets: #2714, #2753, #2510, #2543, #2853
Todo: -

This PR alters flash messages so that it is possible to store more than one message per flash type using the `add()` method or by passing an array of messages to `set()`.

__NOTES ABOUT BC__

This PR maintains BC behaviour with the `Session` class in that the old Symfony 2.0 methods will continue to work as before.

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

by drak at 2012-02-13T06:28:33Z

I think this is ready for review @fabpot @lsmith77

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

by lsmith77 at 2012-02-14T19:30:39Z

the FlashBag vs. AutoExpireFlashBag behavior and setup difference should probably also be explained in the upgrading log

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

by drak at 2012-02-15T04:43:14Z

@lsmith77 Those differences are explained already in the changelog

 * Added `FlashBag`. Flashes expire when retrieved by `get()` or `all()`.
   This makes the implementation ESI compatible.
 * Added `AutoExpireFlashBag` (default) to replicate Symfony 2.0.x auto expire behaviour of messages auto expiring
   after one page page load.  Messages must be retrived by `get()` or `all()`.

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

by Crell at 2012-02-19T17:35:34Z

Drak asked me to weigh in here with use cases.  Drupal currently has a similar session-stored-messaging system in place that I'd like to be able to replace with Flash messages.  We frequently have multiple messages within a single request, however, so this change is critical to our being able to do so.

For instance, when saving an article in Drupal there is, by default, a "yay, you saved an article!" type message that gets displayed.  If you also have the site configured to send email when a post is updated, you may see a "email notifications sent" message (depending on your access level).  If you have a Solr server setup for search, and you're in debug mode, there will also be a "record ID X added to Solr, it should update in 2 minutes" message.  And if there's a bug somewhere, you'll also get, as an error message rather than notice message, a "Oops, E_NOTICE on line 54" message.

Form validation is another case.  If you have multiple errors in a single form, we prefer to list all of them.  So if you screw up 4 times on a form, you may get 4 different error messages showing what you screwed up so you can fix it in one go instead of several.

Now sure, one could emulate that by building a multi-message layer on top of single-layer messages, but, really, why?  "One is a special case of many", and there are many many cases where you'll want to post multiple messages.  Like, most of Drupal. :-)

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

by lsmith77 at 2012-03-06T20:55:51Z

@fabpot is there any information you still need before merging this? do you want more discussion in which case you might want to take this to the mailing list ..

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

by drak at 2012-03-08T18:54:13Z

Another plus for this PR is that it requires no extra lines of code in templates etc to display the flashes, see https://github.com/symfony/symfony/pull/3267/files#diff-1

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

by drak at 2012-03-15T06:38:21Z

Rebased against current `master`, should be mergeable again..

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

by evillemez at 2012-03-17T03:08:41Z

+1 to this, I have an extended version of HttpFoundation just for this... would love to get rid of it.
2012-03-23 17:58:09 +01:00
drmonty 887d70f5f6 fixed small typo in UPGRADE-2.1.md 2012-03-23 08:16:11 +01:00
Drak 5ae76f1e55 [HttpFoundation] Update documentation. 2012-03-15 12:16:26 +05:45
Drak 68074a2be0 Changelog and upgrading changes. 2012-03-14 21:00:04 +05:45
Miha Vrhovnik 6e2a7dabb6 Support session cookie options with cookie_ prefix 2012-02-29 11:54:23 +01:00
Fabien Potencier 3de31c62d6 merged branch snc/session-handler (PR #3436)
Commits
-------

9c8a283 Some \SessionHandlerInterface related documentation updates
9b2de81 Fixed \SessionHandlerInterface in DbalSessionStorage

Discussion
----------

Some \SessionHandlerInterface related updates

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

by snc at 2012-02-23T20:01:51Z

I checked the `Locale` stub in the documentation and it looks like the `\` is not prefixed, so I'll change this, too.

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

by drak at 2012-02-24T07:40:39Z

We really need some tests for the bridge classes, even if they stubs which cause the compiler to at least parse the class, would pick up refactorings like this.
2012-02-27 10:09:42 +01:00
Pavel Campr 8e90903f2f fixed small typo in UPGRADE-2.1.md 2012-02-25 16:44:52 +01:00
H. Westphal 9c8a283c73 Some \SessionHandlerInterface related documentation updates 2012-02-23 21:05:53 +01:00
Johnny Peck b36f2c8211 "Locate" should be "Locale" 2012-02-22 23:10:06 -05:00
Fabien Potencier efc13391fb merged branch jmikola/patch-1 (PR #3349)
Commits
-------

cfddbba Grammar and formatting in upgrade doc

Discussion
----------

Grammar and formatting in upgrade doc

Added logical component headings to changes. Grouped changes by bullets, with indented text and code blocks. Applied consistent formatting to method names and code references. Re-flowed paragraph text to abide an 80-character column.
2012-02-14 23:41:40 +01:00
Henrik Westphal 1bb0ea542b Fixed interface name in UPGRADE-2.1.md 2012-02-14 22:47:35 +01:00
Jeremy Mikola cfddbba4af Grammar and formatting in upgrade doc
Added logical component headings to changes. Grouped changes by bullets, with indented text and code blocks. Applied consistent formatting to method names and code references. Re-flowed paragraph text to abide an 80-character column.
2012-02-13 22:11:40 -05:00
Deni 04919a2978 Fixed formatting in UPGRADE file 2012-02-12 16:14:56 +04:00
Fabien Potencier 7e4f4dcdf9 merged branch bschussek/issue3022 (PR #3322)
Commits
-------

cde34fd [Form] Throwing an AlreadyBoundException in `add`, `remove`, `setParent`, `bind` and `setData` if called on a bound form

Discussion
----------

[Form] Throwing an AlreadyBoundException in `add`, `remove`, `setParent`, `bind` and `setData` if called on a bound form

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

![Travis Build Status](https://secure.travis-ci.org/bschussek/symfony.png?branch=issue3022)

The above mentioned methods now throw an exception because when invoked on a bound form they might cause strange side effects. You should rely on event listeners instead of modifying bound forms.

See also #3022
2012-02-12 00:48:39 +01:00
Fabien Potencier 77844d8cbd fixed UPGRADE file 2012-02-12 00:44:10 +01:00
Fabien Potencier 8a01dd5cff renamed getFlashes() to getFlashBag() to avoid clashes 2012-02-11 13:18:56 +01:00
Fabien Potencier 282d3ae1d8 updated CHANGELOG for 2.1 2012-02-11 12:54:27 +01:00
Fabien Potencier 74ccf7062a reverted 5b7ef11650 (Simplify session
storage class names now we have a separate namespace for sessions)
2012-02-11 12:04:50 +01:00
Fabien Potencier 7878a0a11a [HttpFoundation] renamed pop() to all() and getAll() to all() 2012-02-11 11:53:00 +01:00
Drak 0d2745f750 [HttpFoundation] Remove constants from FlashBagInterface
As requested by fabpot.
Corrected a few mistakes in the documentation.
2012-02-11 11:24:43 +05:45
Drak 5b7ef11650 [HttpFoundation] Simplify session storage class names now we have a separate namespace for sessions. 2012-02-11 11:24:35 +05:45
Drak 27530cbb1e [HttpFoundation] Moved session related classes to own sub-namespace. 2012-02-11 11:24:31 +05:45
Drak 468391525a [HttpFoundation] Free bags from session storage and move classes to their own namespaces. 2012-02-11 11:24:26 +05:45
Drak f9951a39eb Fixed formatting. 2012-02-11 11:24:18 +05:45
Drak 398acc9e9f [HttpFoundation] Reworked flashes to maintain same behaviour as in Symfony 2.0 2012-02-11 11:24:15 +05:45
Drak f98f9ae8ff [HttpFoundation] Refactor for DRY code.
Rename ArraySessionStorage to make it clear the session is a mock for testing purposes only.
Has BC class for ArraySessionStorage
Added sanity check when starting the session.
Fixed typos and incorrect php extension test method
session_module_name() also sets session.save_handler, so must use extension_loaded() to check if module exist
or not.
Respect autostart settings.
2012-02-11 11:24:11 +05:45
Drak 9dd4dbed6d Documentation, changelogs and coding standards. 2012-02-11 11:24:07 +05:45
Bernhard Schussek cde34fd8ce [Form] Throwing an AlreadyBoundException in `add`, `remove`, `setParent`, `bind` and `setData` if called on a bound form 2012-02-10 15:40:01 +01:00
Bernhard Schussek 22c8f8087c [Form] Fixed issues mentioned in the PR comments 2012-02-09 17:13:33 +01:00
Bernhard Schussek 88ef52d272 [Form] Improved FormType::getDefaultOptions() to see default options defined in parent types
In turn, FormType::getParent() does not see default options anymore.
2012-02-07 10:51:21 +01:00
Fabien Potencier 8245bf13d5 merged branch bschussek/issue2615 (PR #3228)
Commits
-------

2e4ebe4 [Validator] Renamed methods addViolationAtRelativePath() and getAbsolutePropertyPath() in ExecutionContext
9153f0e [Validator] Deprecated ConstraintValidator methods setMessage(), getMessageTemplate() and getMessageParameters()
0417282 [Validator] Fixed typos
a30a679 [Validator] Made ExecutionContext immutable and introduced new class GlobalExecutionContext
fe85bbd [Validator] Simplified ExecutionContext::addViolation(), added ExecutionContext::addViolationAt()
f77fd41 [Form] Fixed typos
1fc615c Fixed string access by curly brace to bracket
a103c28 [Validator] The Collection constraint adds "missing" and "extra" errors to the individual fields now
f904a9e [Validator] Fixed: GraphWalker does not add constraint violation if error message is empty
1dd302c [Validator] Fixed ConstraintViolationList::__toString() to not include dots in the output if the root is empty
1678a3d [Validator] Fixed: Validator::validateValue() propagates empty validation root instead of the provided value

Discussion
----------

[Validator] Improved "missing" and "extra" errors of Collection constraint

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

![Travis Build Status](https://secure.travis-ci.org/bschussek/symfony.png?branch=issue2615)

Instead of a single violation

    Array:
        The fields "foo", "bar" are missing

various violations are now generated.

    Array[foo]:
        This field is missing
    Array[bar]:
        This field is missing

Apart from that, the PR contains various minor fixes to the Validator.

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

by bschussek at 2012-02-02T09:14:52Z

@fabpot Ready for merge.
2012-02-02 10:16:32 +01:00
Bernhard Schussek 9153f0e569 [Validator] Deprecated ConstraintValidator methods setMessage(), getMessageTemplate() and getMessageParameters()
Had to refactor the validation tests at the same time and fixed various small bugs while doing so.
2012-02-01 14:03:13 +01:00
Bernhard Schussek 2c530cc236 Fixed typos in UPGRADE file 2012-01-30 13:36:34 +01:00
Bernhard Schussek 7899bea3e5 Added examples to UPGRADE 2012-01-30 11:10:25 +01:00
Bernhard Schussek d346ae6a8f Improved choice list sections of UPGRADE and CHANGELOG 2012-01-30 10:57:14 +01:00
Bernhard Schussek 600cec746a [Form] Added missing entries to CHANGELOG and UPGRADE 2012-01-28 13:37:13 +01:00
Bernhard Schussek 5f6f75c026 [Form] Fixed outstanding issues mentioned in the PR 2012-01-24 11:59:07 +01:00
Bernhard Schussek 7c7097675b [Form] Fixed text in UPGRADE file 2012-01-24 01:23:01 +01:00
Bernhard Schussek d72900e613 [Form] Incorporated changes suggested in PR comments 2012-01-23 18:58:56 +01:00
Bernhard Schussek 28d2f6d38d Removed duplicated lines from UPGRADE file 2012-01-23 18:28:25 +01:00
Bernhard Schussek 87b16e7015 [Form] Greatly improved ChoiceListInterface and all of its implementations
Fixes #2869, fixes #3021, fixes #1919, fixes #3153.
2012-01-23 18:28:25 +01:00
Tobias Schultze bf5ccb0ae6 resolved conflict 2012-01-17 10:53:31 +01:00
Bernhard Schussek 43293f4bc5 Updated UPGRADED file to reflect changes merged in e056480ab2 2012-01-17 00:52:13 +01:00
Dariusz Górecki 2a74ac31d2 Add info about BC Break to CHANGELOG-2.1 and UPGRADE-2.1 2012-01-13 07:16:58 +01:00
H. Westphal c915f4851f Added another "before" possibility to retrieve the locale from a Twig template. 2011-10-22 11:23:43 +02:00
Fabien Potencier 74bc699b27 moved management of the locale from the Session class to the Request class
The locale management does not require sessions anymore.

In the Symfony2 spirit, the locale should be part of your URLs. If this is the case
(via the special _locale request attribute), Symfony will store it in the request
(getLocale()).

This feature is now also configurable/replaceable at will as everything is now managed
by the new LocaleListener event listener.

How to upgrade:

The default locale configuration has been moved from session to the main configuration:

Before:

framework:
    session:
        default_locale: en

After:

framework:
    default_locale: en

Whenever you want to get the current locale, call getLocale() on the request (was on the
session before).
2011-10-08 18:34:49 +02:00
Fabien Potencier 8b55541aee added an UPGRADE file 2011-10-08 18:29:31 +02:00