Commit Graph

10389 Commits

Author SHA1 Message Date
Fabien Potencier
2447757a4e merged branch bschussek/datetimetostringtransformer (PR #6333)
This PR was merged into the 2.1 branch.

Commits
-------

b20c5ca [Form] Fixed reverse transformation of values in DateTimeToStringTransformer

Discussion
----------

[Form] Fixed reverse transformation of values in DateTimeToStringTransformer

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

The parts not given in the format are reset to the corresponding values of
the UNIX base timestamp. For example, when parsing with the format "Y-m-d",
parsing

    "2012-05-18"

now results in the date

    "2012-05-18 00:00:00 UTC"

instead of

    "2012-05-18 12:58:27 UTC"

as before, where the time part corresponded to the local server time.

Another example: When parsing with the format "H:i:s", parsing

    "12:58:27"

now results in

    "1970-01-01 12:58:27 UTC"

instead of

    "2012-12-13 12:58:27 UTC"

as before, where again the date part corresponded to the local server time.

This behavior is now consistent with DateTimeToArrayTransformer and
DateTimeToLocalizedStringTransformer.
2012-12-13 21:21:50 +01:00
Fabien Potencier
5a8534a5db merged branch umpirsky/fix-issue-5797 (PR #6331)
This PR was merged into the master branch.

Commits
-------

2196810 Added QtTranslationsLoader tests.
201818b Fixed #5797.

Discussion
----------

[Translation] Fixed #5797.

This should fix issue #5797.

What I did is prevented `Translator` to throw `NotFoundResourceException` if resource is not found and there are fallback locales to process. This happens for locales like `en_GB`, `fr_FR`...

I also tested this fix against real application which uses Validation component without full stack framework and I was able to use `en_GB` locale without any errors only after this fix.
2012-12-13 21:21:21 +01:00
umpirsky
74a06f84b6 QtTranslationsLoader class renamed to QtFileLoader. 2012-12-13 20:15:36 +01:00
umpirsky
219681092c Added QtTranslationsLoader tests. 2012-12-13 19:47:04 +01:00
Bernhard Schussek
b20c5ca2ef [Form] Fixed reverse transformation of values in DateTimeToStringTransformer
The parts not given in the format are reset to the corresponding values of
the UNIX base timestamp. For example, when parsing with the format "Y-m-d",
parsing

    "2012-05-18"

now results in the date

    "2012-05-18 00:00:00 UTC"

instead of

    "2012-05-18 12:58:27 UTC"

as before, where the time part corresponded to the local server time.

Another example: When parsing with the format "H:i:s", parsing

    "12:58:27"

now results in

    "1970-01-01 12:58:27 UTC"

instead of

    "2012-12-13 12:58:27 UTC"

as before, where again the date part corresponded to the local server time.

This behavior is now consistent with DateTimeToArrayTransformer and
DateTimeToLocalizedStringTransformer.
2012-12-13 19:30:06 +01:00
Fabien Potencier
4c3edc276a Merge branch '2.1'
* 2.1:
  [Console] Add support for parsing terminal width/height on localized windows, fixes #5742
  [Form] Fixed treatment of countables and traversables in Form::isEmpty()
  refactor ControllerNameParser
  [Form] Fixed FileType not to throw an exception when bound empty
  - Test undefined index #
  Maintain array structure
  Check if key # is defined in $value
  Update src/Symfony/Component/Validator/Resources/translations/validators.pl.xlf
2012-12-13 19:25:06 +01:00
umpirsky
201818bd4b Fixed #5797. 2012-12-13 18:48:40 +01:00
Jordi Boggiano
d2231d8cd8 [Console] Add support for parsing terminal width/height on localized windows, fixes #5742 2012-12-13 18:42:00 +01:00
Fabien Potencier
99a66c97d5 merged branch vicb/kernel/stripcomments (PR #6328)
This PR was merged into the master branch.

Commits
-------

aab60e3 [HttpKernel] fix public Kernel::stripComments()

Discussion
----------

[HttpKernel] fix public Kernel::stripComments()

Needs fix as the method is public.

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

by fabpot at 2012-12-13T17:01:52Z

Can you explain what you mean by "Needs fix as the method is public."?

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

by vicb at 2012-12-13T17:15:05Z

@fabpot One can argue that the fix could not be reached if the method was private.
2012-12-13 18:31:33 +01:00
Fabien Potencier
548dc64639 merged branch fabpot/webprofiler-refactor (PR #6323)
This PR was merged into the master branch.

Commits
-------

142cffb fixed unit tests
fc444f1 fixed support for Twig loaders when they do not extend Twig_ExistsLoaderInterface
f005649 [WebProfilerBundle] decoupled the bundle from TwigBundle
35d63df removed the dependency on the container for exception handling

Discussion
----------

Webprofiler refactor

This PR removes two hard dependencies from WebProfilerBundle:

 * The dependency on the DIC;
 * The dependency on TwigBundle.

It also removes the dependency on the DIC in the exception controller from TwigBundle for more consistency.
2012-12-13 18:14:33 +01:00
Fabien Potencier
142cffbc4f fixed unit tests 2012-12-13 17:59:38 +01:00
Victor Berchet
aab60e33a9 [HttpKernel] fix public Kernel::stripComments() 2012-12-13 17:56:02 +01:00
Fabien Potencier
fc444f1a55 fixed support for Twig loaders when they do not extend Twig_ExistsLoaderInterface 2012-12-13 17:11:26 +01:00
Fabien Potencier
21f8f8c62d merged branch bschussek/issue6246 (PR #6322)
This PR was merged into the master branch.

Commits
-------

81bdab8 [Validator] Fixed: Arrays are validated recursively by default

Discussion
----------

[Validator] Arrays are validated recursively now by default

Bug fix: yes
Feature addition: yes?
Backwards compatibility break: yes
Symfony2 tests pass: yes
Fixes the following tickets: #6246
Todo: -
License of the code: MIT
Documentation PR: -
2012-12-13 16:20:40 +01:00
Fabien Potencier
f005649315 [WebProfilerBundle] decoupled the bundle from TwigBundle 2012-12-13 16:01:47 +01:00
Fabien Potencier
35d63df044 removed the dependency on the container for exception handling 2012-12-13 15:49:45 +01:00
Bernhard Schussek
81bdab8b44 [Validator] Fixed: Arrays are validated recursively by default 2012-12-13 15:47:07 +01:00
Fabien Potencier
2f4ac5e3d1 bumped min version of Twig to 1.11.0 2012-12-13 15:33:46 +01:00
Bernhard Schussek
03b880fed0 [Form] Fixed treatment of countables and traversables in Form::isEmpty() 2012-12-13 15:18:14 +01:00
Tobias Schultze
35e19c76c3 refactor ControllerNameParser 2012-12-13 15:04:21 +01:00
Fabien Potencier
81fc922f16 merged branch vmattila/master (PR #6320)
This PR was merged into the master branch.

Commits
-------

77ffdad Finnish Validator translations updated.

Discussion
----------

Finnish Validator translations updated.

This PR contains an updated Validator translation file for Finnish language.
2012-12-13 15:01:33 +01:00
Ville Mattila
77ffdad558 Finnish Validator translations updated. 2012-12-13 15:51:31 +02:00
Bernhard Schussek
21a59ca04c [Form] Fixed FileType not to throw an exception when bound empty 2012-12-13 14:33:06 +01:00
Tobias Schultze
c2dc758146 [Translation] fix typo in changelog 2012-12-13 13:24:44 +01:00
Fabien Potencier
142d3389ef merged branch fabpot/translator-loaders (PR #6308)
This PR was merged into the master branch.

Commits
-------

34d0c6b [Translation] uniformized the way exception are thrown in LoaderInterface::load()

Discussion
----------

[Translation] uniformized the way exception are thrown in LoaderInterface::load()

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

by fabpot at 2012-12-12T19:44:36Z

followup for #6301 (cc @umpirsky)

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

by umpirsky at 2012-12-12T19:59:05Z

Does this means that we will catch this exception in `Translator` in order to fix #5797?
If yes, maybe we should add new `TranslationResourceNotFoundException` or something similar?

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

by fabpot at 2012-12-13T10:01:23Z

I've created two new exception classes: `NotFoundResourceException` for when the resource does not exist and `InvalidResourceException` when a problem occurs when loading the resource. That should give us everything we need to fix #5797.

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

by umpirsky at 2012-12-13T10:05:08Z

Perfect, thanks.

I'll give it a try later today.

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

by umpirsky at 2012-12-13T11:58:37Z

@fabpot Will you merge or I should fork your branch?
2012-12-13 13:00:54 +01:00
Fabien Potencier
75636a00da [WebProfilerBundle] added missing exclusion in phpunit.xml.dist 2012-12-13 11:03:59 +01:00
Fabien Potencier
34d0c6b640 [Translation] uniformized the way exception are thrown in LoaderInterface::load() 2012-12-13 11:00:37 +01:00
Fabien Potencier
b4e7ff241f merged branch hason/czech_validator (PR #6316)
This PR was merged into the master branch.

Commits
-------

eb2c293 Updated czech translations

Discussion
----------

Updated czech translations
2012-12-13 10:50:36 +01:00
Martin Hasoň
eb2c293728 Updated czech translations 2012-12-13 10:09:16 +01:00
Haritz
fc6290695a Update basque translation
Update translations in lines 195 and 203
2012-12-13 09:23:48 +01:00
Fabien Potencier
ea5929c991 merged branch alsar/slovenian-translation (PR #6311)
This PR was merged into the master branch.

Commits
-------

29595d1 added slovenian translations

Discussion
----------

[Validator] Added Slovenian translations for card validation
2012-12-12 22:15:28 +01:00
Fabien Potencier
d040e91bf1 merged branch meigwilym/master (PR #6310)
This PR was merged into the master branch.

Commits
-------

6c6bf53 first translation to Welsh

Discussion
----------

[Validator][Resources] added new Welsh translation file

Added a Welsh (cy) version of src/Symfony/Component/Validator/Resources/translations/validators.en.xlf
2012-12-12 22:14:35 +01:00
alsar
29595d1a71 added slovenian translations 2012-12-12 22:05:51 +01:00
Mei Gwilym
6c6bf53b46 first translation to Welsh 2012-12-12 20:52:11 +00:00
Eugene Leonovich
3d736ee3e9 [Validator] Update Russian validation messages 2012-12-12 21:03:17 +01:00
Fabien Potencier
9d2efd3071 merged branch dlsniper/ro-translations (PR #6307)
This PR was merged into the master branch.

Commits
-------

58f9d00 Updated Romanian translations

Discussion
----------

Updated Romanian translations

Added Romanian translation for card validation
2012-12-12 20:46:36 +01:00
Florin Patan
58f9d0042d Updated Romanian translations 2012-12-12 21:31:29 +02:00
Fabien Potencier
6b5a9525c1 merged branch umpirsky/issue-5797 (PR #6301)
This PR was merged into the master branch.

Commits
-------

a1fb945 CS fixes.
ac58681 Fix loaders to check if resource exists.

Discussion
----------

[Translation] Fix loaders to check if resource exists.

This was mentioned in #5797.

The problem is that some translation loaders throw exception when translation resource is not found, some produce warnings and some ignore this and return empty catalog.

After this fix, all of them will throw exception in such case. But still, some of them will throw `RuntimeException` and some `InvalidArgumentException` which is not perfect, but still one step in right direction.
2012-12-12 20:08:05 +01:00
Fabien Potencier
b29491cd60 merged branch umpirsky/clean-finder-test (PR #6305)
This PR was merged into the master branch.

Commits
-------

57e70a7 Small cleanup in Finder tests.

Discussion
----------

[Finder] Small cleanup in tests.
2012-12-12 20:03:58 +01:00
Fabien Potencier
a45fb93010 merged branch hizai/master (PR #6303)
This PR was merged into the master branch.

Commits
-------

af3e314 Updated basque translations

Discussion
----------

Updated basque translations
2012-12-12 20:01:44 +01:00
umpirsky
57e70a78d0 Small cleanup in Finder tests. 2012-12-12 19:55:22 +01:00
Andreia Bohner
655fd6ef4c Update Portuguese validation messages 2012-12-12 16:43:57 -02:00
Eduardo Gulias Davis
b4e894a07d - Test undefined index # 2012-12-12 18:17:16 +01:00
Harry Walter
b73b87d571 Maintain array structure 2012-12-12 18:17:16 +01:00
Harry Walter
eac14b5ef2 Check if key # is defined in $value
If # is undefined in $value use set the attribute value as $value
2012-12-12 18:17:16 +01:00
Haritz
af3e3149d1 Updated basque translations 2012-12-12 18:09:02 +01:00
Fabien Potencier
2da97c1a2f fixed CS 2012-12-12 17:59:52 +01:00
Fabien Potencier
acc10a1518 merged branch istaveren/ticket_5288 (PR #6109)
This PR was merged into the master branch.

Commits
-------

12a890f Issue 5288 fix

Discussion
----------

Issue #5288 fix

I only have the test failing on

php -v
5.4.6-1ubuntu1

ICU version 4.8.1.1

Test results

1) Symfony\Component\Locale\Tests\Stub\StubLocaleTest::testGetCurrenciesData
    Failed asserting that two strings are equal.
    --- Expected
    +++ Actual
    @@ @@
    -'BR$'
    +'R$'

It looks like the check $this->isSameAsIcuVersion('4.8') on line is to strict.
It was added here https://github.com/symfony/symfony/commit/90d6dc37 but I don't how to test the fix on icu version 4.8.0.x

Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: #5288
Todo: Check older version of the ICU lib are still working. Because I could not test that.
2012-12-12 17:59:16 +01:00
Colin Frei
d5b2638ff4 [Form] Trigger errors for deprecated methods in Form Component 2012-12-12 17:43:13 +01:00
umpirsky
a1fb94510f CS fixes. 2012-12-12 17:37:31 +01:00
umpirsky
ac58681ae4 Fix loaders to check if resource exists. 2012-12-12 17:37:30 +01:00
Fabien Potencier
3140a589d2 merged branch bertzzie/indo-translation-57-58 (PR #6296)
This PR was merged into the master branch.

Commits
-------

082e8b9 [Validation] Added more Indonesian translation.

Discussion
----------

[Validation] Added more Indonesian translation.

- Added Indonesian translation for translation unit no. 57 and 58.

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

by bertzzie at 2012-12-12T16:16:09Z

This is to add some more translation I missed from the pull request before, here:

https://github.com/symfony/symfony/pull/6289#issuecomment-11291990

Thanks.
2012-12-12 17:35:00 +01:00
Fabien Potencier
067a83c757 merged branch Spea/german-translation (PR #6300)
This PR was merged into the master branch.

Commits
-------

00422dc [Validator] Card validation - German translation

Discussion
----------

[Validator] Card validation - German translation
2012-12-12 17:33:21 +01:00
Fabien Potencier
775b1e36dd merged branch empire/patch-card-validation (PR #6299)
This PR was merged into the master branch.

Commits
-------

ada0875 Added farsi translation for card valdiation

Discussion
----------

[Validator] Added farsi translation for card valdiation
2012-12-12 17:31:29 +01:00
Hossein Zolfi (Ocean)
ada08753e1 Added farsi translation for card valdiation 2012-12-12 19:56:56 +03:30
Martin Parsiegla
00422dc009 [Validator] Card validation - German translation 2012-12-12 17:26:14 +01:00
Alex Xandra Albert Sim
082e8b96fa [Validation] Added more Indonesian translation.
- Added Indonesian translation for translation unit no. 57 and 58.
2012-12-12 23:14:18 +07:00
Fabien Potencier
7bce9b0f28 merged branch sineld/master (PR #6294)
This PR was merged into the master branch.

Commits
-------

d52f8f7 Turkish Language File Translated

Discussion
----------

Turkish Language File Translated
2012-12-12 16:53:09 +01:00
Sinan Eldem
d52f8f781a Turkish Language File Translated 2012-12-12 17:41:33 +02:00
Fabien Potencier
7d8458f2d2 merged branch agarfors/master (PR #6292)
This PR was merged into the master branch.

Commits
-------

ab58c7f [Validator] Card validation - Norwegian translation unit 54-48

Discussion
----------

[Validator] Card validation - Norwegian translation unit 54-58
2012-12-12 16:38:13 +01:00
Åsmund Garfors
ab58c7fc84 [Validator] Card validation - Norwegian translation unit 54-48 2012-12-12 16:07:02 +01:00
Fabien Potencier
57f1f065ff merged branch pierredup/validator_translations (PR #6291)
This PR was merged into the master branch.

Commits
-------

34df35d Added validation messages for  Afrikaans

Discussion
----------

[Validator] Validation messages - Afrikaans translatios
2012-12-12 15:58:01 +01:00
Fabien Potencier
f7ce6c7152 merged branch agarfors/master (PR #6290)
This PR was merged into the master branch.

Commits
-------

402cfde [Validator] Card validation - Norwegian translations

Discussion
----------

[Validator] Card validation - Norwegian translations

Noregian nynorsk translation
2012-12-12 15:57:32 +01:00
Fabien Potencier
1f0b28326e merged branch bertzzie/validation-indo-translation (PR #6289)
This PR was merged into the master branch.

Commits
-------

08f2631 [Validation] Improve Indonesian translation.

Discussion
----------

[Validation] Improve Indonesian translation.

- Improve some translation's grammar.
- Added translation unit no. 49 - 56.
2012-12-12 15:57:12 +01:00
Fabien Potencier
aac361c65b merged branch 1ed/patch-2 (PR #6288)
This PR was merged into the master branch.

Commits
-------

89181a8 [Validator] added Hungarian translations for card validation

Discussion
----------

[Validator] added Hungarian translations for card validation
2012-12-12 15:55:48 +01:00
Fabien Potencier
f6c8538e44 merged branch jordillonch/master (PR #6286)
This PR was merged into the master branch.

Commits
-------

5cc4390 Updated catalan translations for validators

Discussion
----------

Updated catalan translations for validators
2012-12-12 15:55:25 +01:00
Fabien Potencier
e6bae7bbe0 merged branch bobdenotter/master (PR #6284)
This PR was merged into the master branch.

Commits
-------

075c4cb [Validator] Card validation - Dutch translations

Discussion
----------

[Validator] Card validation - Dutch translations
2012-12-12 15:54:55 +01:00
Fabien Potencier
b8c04abafd merged branch stewe/translations-it (PR #6283)
This PR was merged into the master branch.

Commits
-------

b2ff4d8 [Validator] Card validation - Italian translations

Discussion
----------

[Validator] Card validation - Italian translations

Bug fix: no
Feature addition: yes
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: n/a
Todo: n/a
License of the code: MIT
Documentation PR: n/a
2012-12-12 15:54:34 +01:00
Fabien Potencier
f66e6b8f6f merged branch iambrosi/validation-translations-1 (PR #6282)
This PR was merged into the master branch.

Commits
-------

3a6372d Updated spanish translations for validators

Discussion
----------

Updated spanish translations for validators

Added translations for credit card related messages
2012-12-12 15:54:12 +01:00
Pierre du Plessis
34df35dc37 Added validation messages for Afrikaans 2012-12-12 16:41:36 +02:00
Åsmund Garfors
402cfde4bb [Validator] Card validation - Norwegian translations 2012-12-12 15:38:03 +01:00
Gábor Egyed
89181a84a2 [Validator] added Hungarian translations for card validation 2012-12-12 15:36:59 +01:00
Stefano Sala
b2ff4d886d [Validator] Card validation - Italian translations 2012-12-12 15:27:04 +01:00
Alex Xandra Albert Sim
08f26318d3 [Validation] Improve Indonesian translation.
- Improve some translation's grammar.
- Added translation unit no. 49 - 56.
2012-12-12 21:26:22 +07:00
Jordi Llonch
5cc4390fa2 Updated catalan translations for validators 2012-12-12 15:24:50 +01:00
Bob den Otter
075c4cb5aa [Validator] Card validation - Dutch translations 2012-12-12 15:12:50 +01:00
Ismael Ambrosi
3a6372df4e Updated spanish translations for validators
Added translations for credit card related messages
2012-12-12 12:07:26 -02:00
Tiago Brito
c9e842c092 Update validators.pt.xlf to to Portuguese
Translating new validation (57 and 58) messages to Portuguese language
2012-12-12 13:58:55 +00:00
Joseph Bielawski
ed132970dd [Validator] Card validation - Polish translations 2012-12-12 14:39:42 +01:00
Joseph Bielawski
6a9a8c024e Update src/Symfony/Component/Validator/Resources/translations/validators.pl.xlf
Fixed polish translation
2012-12-12 14:03:58 +01:00
umpirsky
d789e5ab44 Serbian translation for card scheme constraint message. 2012-12-12 13:18:02 +01:00
umpirsky
76d653f448 Serbian translation for Luhn constraint message. 2012-12-12 13:11:42 +01:00
Fabien Potencier
8feda90139 merged branch asm89/yaml-inline (PR #6277)
This PR was merged into the master branch.

Commits
-------

2f07966 [Yaml] Add test showing that dates before 01 Jan 1970 are correctly parsed

Discussion
----------

[Yaml] Add test showing that dates before 01 Jan 1970 are correctly parsed

Bug fix: no
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes

Adds a test related to issue #6275, showing that the Yaml inline parsing supports ISO 8601 dates before 1980.
2012-12-12 12:39:44 +01:00
Fabien Potencier
6eba7abb2c [WebProfilerBundle] fixed composer.json and added missing PHPUnit configuration 2012-12-12 12:39:13 +01:00
Fabien Potencier
e553e65047 moved the Twig CodeExtension from the bundle to the bridge 2012-12-12 12:26:16 +01:00
Alexander
2f07966677 [Yaml] Add test showing that dates before 01 Jan 1970 are correctly parsed 2012-12-12 11:54:56 +01:00
Bilal Amarni
26b8b47221 checked for a potentially missing key
The 'function' key isn't always available in the trace. This was
causing me a notice.
2012-12-12 10:42:27 +01:00
Rafał Wrzeszcz
c331ccd500 Added XHTML content type to ESI defaults. 2012-12-12 00:08:01 +01:00
Fabien Potencier
18c520a5e8 merged branch Tobion/loaders (PR #6172)
This PR was merged into the master branch.

Commits
-------

237bbd0 fixed and refactored YamlFileLoader in the same sense as the XmlFileLoader
392d785 removed covers annotation from loader tests and unneeded use statements
45987eb added tests for the previous XmlFileLoader fixes
b20d6a7 ensure id, pattern and resource are specified
8361b5a refactor the XMlFileLoader
83fc5ff fix namespace handling in xml loader; it could not handle prefixes
1a60a3c make resource and key attributes required in xsd
02e01b9 improve exception messages in xml loader
51fbffe remove unneeded cast
358e9c4 fix some phpdoc

Discussion
----------

[Routing] improve loaders

BC break: no

Main points:
- fixed Xml loader that could not handle namespace prefixes but is valid xml
- fixed Yaml loader where some nonsesense configs were not validated correctly like an imported resource with a pattern key.

Added tests for all. Some refactoring + a few tweaks like better exception messages and more consistency between Xml loader and yaml loader. See also commits.

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

by Tobion at 2012-12-07T18:16:08Z

@fabpot this is ready

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

by Tobion at 2012-12-11T17:30:10Z

@fabpot rebased. Please don't squash to one big commit where one does not see what changed why.

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

by fabpot at 2012-12-11T17:32:40Z

I only squash when most commits are CS fixes and feedback.

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

by Tobion at 2012-12-11T17:37:49Z

Well, you squashed #6022 so it's not possible to revert a specific deprecation.
2012-12-11 18:46:52 +01:00
Tobias Schultze
237bbd0578 fixed and refactored YamlFileLoader in the same sense as the XmlFileLoader
some nonsesense configs were not validated correctly like an imported resource with a pattern key. added tests for such things too.
2012-12-11 18:26:19 +01:00
Tobias Schultze
392d785d91 removed covers annotation from loader tests and unneeded use statements 2012-12-11 18:03:52 +01:00
Tobias Schultze
45987eb2b7 added tests for the previous XmlFileLoader fixes 2012-12-11 18:03:51 +01:00
Tobias Schultze
b20d6a7960 ensure id, pattern and resource are specified
the yaml loader also requires the pattern to be given, so the xml loader should do the same
2012-12-11 18:03:50 +01:00
Tobias Schultze
8361b5a58b refactor the XMlFileLoader 2012-12-11 18:03:49 +01:00
Bilal Amarni
a0e2391063 [FrameworkBundle] used the new method for trusted proxies 2012-12-11 17:56:21 +01:00
Fabien Potencier
2578f1ef58 merged branch stloyd/feature/form-labels (PR #6262)
This PR was merged into the master branch.

Commits
-------

d5426f0 [Form] Add tests to prove that label is not rendered when is marked as false
120547c [Form][TwigBridge] Don't set label attributes if is marked as not to be rendered [Form][FrameworkBundle] Add option to disable rendering of label for fields
36e4556 [Form] Option for not displaying a label by setting label to false. [Form] Fixed formatting & translation ..

Discussion
----------

[Form] Added option for not displaying a form-label by setting label to false

Bug fix: no
Feature addition: yes
Backwards compatibility break: no
Symfony2 tests pass: yes
Replaces: #5421

@fabpot @BenjaminBeck: I was just not sure what to do with "table based" forms, so I left `<td></td>` rendered when there is no label, because I'm not sure that we can hide it easily.

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

by XWB at 2012-12-11T09:30:14Z

👍
2012-12-11 17:55:20 +01:00
Tobias Schultze
83fc5ff72f fix namespace handling in xml loader; it could not handle prefixes 2012-12-11 17:52:57 +01:00
Tobias Schultze
1a60a3ceb5 make resource and key attributes required in xsd 2012-12-11 17:52:56 +01:00
Tobias Schultze
02e01b9798 improve exception messages in xml loader 2012-12-11 17:52:55 +01:00
Tobias Schultze
51fbffec26 remove unneeded cast 2012-12-11 17:52:53 +01:00
Tobias Schultze
358e9c47b9 fix some phpdoc 2012-12-11 17:52:53 +01:00
Victor Berchet
70a69d4874 [Routing] fix typo 2012-12-11 17:22:27 +01:00
Fabien Potencier
7200703089 fixed CS 2012-12-11 15:06:57 +01:00
Fabien Potencier
8bbc64d3ec merged branch robqu/patch-progressbar (PR #6266)
This PR was merged into the master branch.

Commits
-------

ea74610 jumping progress bar fix for windows & unix
6a0ee27 [Console] fixed progress bar jumping

Discussion
----------

[Console] fixed progress bar jumping for windows & unix env

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

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

by pborreli at 2012-12-11T13:58:25Z

Good implementation but could you please check http://symfony.com/doc/current/contributing/code/standards.html
2012-12-11 15:05:51 +01:00
Robert Queck
ea74610723 jumping progress bar fix for windows & unix 2012-12-11 14:31:22 +01:00
Fabien Potencier
51bcb6e7ee merged branch Tobion/collection-api (PR #6022)
This PR was squashed before being merged into the master branch (closes #6022).

Commits
-------

8c7a169 [Routing] clean up of RouteCollection API

Discussion
----------

[Routing] clean up of RouteCollection API

BC break: only the internal behavior of addPrefix()
Deprecations:
- some params of addCollection and addPrefix that still work but should not be used anymore
- getPrefix (you cannot rely on it how my added test shows that failed previously but was fixed with https://github.com/symfony/symfony/pull/6120/files#L5L109
and it's also useless since we dont have a tree anymore)

Reasoning see commits and changelog.

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

by Tobion at 2012-12-06T19:15:53Z

@fabpot this is finished and rebased. I switched from `addConfigs` to addDefaults(), addRequirements(), and addOptions() as you suggested. I also deprecated getPrefix(). Reasoning see above and in the changelog.
2012-12-11 14:02:38 +01:00
Tobias Schultze
8c7a169a4a [Routing] clean up of RouteCollection API 2012-12-11 14:02:38 +01:00
Fabien Potencier
7464833ece [Filesystem] added a missing CHANGELOG item and fixed some CS 2012-12-11 13:58:05 +01:00
Fabien Potencier
b3c58e7b90 merged branch mylen/master (PR #6014)
This PR was squashed before being merged into the master branch (closes #6014).

Commits
-------

2b13760 [Filesystem] [mirror] added "delete" option

Discussion
----------

[Filesystem] [mirror] added "delete" option

Bug fix: no
Feature addition: yes
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets:
Todo: -
License of the code: MIT
Documentation PR: symfony/symfony-docs#123

I added a "delete" option to the mirror function. If set to true, then
files present in target dir and not in origin dir will be removed.

Added also unit test for these feature.

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

by pborreli at 2012-11-16T00:58:19Z

Symfony2 code standard use lowercase `true` and `false`

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

by mylen at 2012-11-16T20:25:19Z

I have problem to believe that the last commit (merging two if together) was to blame for the segfault on  travis...
when I run the unit testing on my machine, I get:

I'm using PHP 5.4.7 by the way...

Time: 2 seconds, Memory: 3.25Mb

OK, but incomplete or skipped tests!
Tests: 80, Assertions: 106, Skipped: 14.

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

by pborreli at 2012-11-16T20:38:40Z

Can you fix end-of-lines ?

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

by mylen at 2012-11-16T20:52:37Z

I put UNIX line feed and UTF8 charset

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

by mylen at 2012-11-16T20:53:59Z

Sorry, I add to clone the symfony repo with github and did small editing using pspad, I forgot to setup charset and line feed...
2012-12-11 13:55:45 +01:00
Alexandre Melard
2b13760e90 [Filesystem] [mirror] added "delete" option 2012-12-11 13:55:45 +01:00
Fabien Potencier
e42ab1da2c merged branch Burgov/patch-2 (PR #6263)
This PR was merged into the 2.0 branch.

Commits
-------

e6bb156 remove realpath call

Discussion
----------

[HttpKernel] remove realpath call

I'm trying to create an executable phar archive from a Symfony application, but when I run the phar, it fails to find any commands because of this php bug/feature:

https://bugs.php.net/bug.php?id=52769

After this change, my archive works just like a normal app/console call
2012-12-11 11:51:02 +01:00
Fabien Potencier
fdb11be242 fixed CS 2012-12-11 11:49:22 +01:00
Fabien Potencier
3c010db2cb Merge branch '2.1'
* 2.1:
  fixed CS
  fixed CS
  [Security] fixed path info encoding (closes #6040, closes #5695)
  [HttpFoundation] added some tests for the previous merge and removed dead code (closes #6037)
  Improved Cache-Control header when no-cache is sent
  removed unneeded comment
  Fix to allow null values in labels array
  fix date in changelog
  removed the Travis icon (as this is not stable enough -- many false positive, closes #6186)
  Revert "merged branch gajdaw/finder_splfileinfo_fpassthu (PR #4751)" (closes #6224)
  Fixed a typo
  Fixed: HeaderBag::parseCacheControl() not parsing quoted zero correctly
  [Form] Fix const inside an anonymous function
  [Config] Loader::import must return imported data
  [DoctrineBridge] Fixed caching in DoctrineType when "choices" or "preferred_choices" is passed
  [Form] Fixed the default value of "format" in DateType to DateType::DEFAULT_FORMAT if "widget" is not "single_text"
  [HttpFoundation] fixed a small regression

Conflicts:
	src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php
2012-12-11 11:41:51 +01:00
Fabien Potencier
7f3be5c49d fixed CS 2012-12-11 11:40:22 +01:00
Fabien Potencier
d2885adffe Merge branch '2.0' into 2.1
* 2.0:
  fixed CS
  removed the Travis icon (as this is not stable enough -- many false positive, closes #6186)
  [Config] Loader::import must return imported data
  [HttpFoundation] fixed a small regression

Conflicts:
	README.md
	src/Symfony/Bridge/Twig/Extension/FormExtension.php
	src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/attributes.html.php
	src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/form_widget.html.php
	src/Symfony/Bundle/FrameworkBundle/Templating/Helper/FormHelper.php
	src/Symfony/Component/Form/Form.php
	src/Symfony/Component/HttpFoundation/Request.php
	src/Symfony/Component/HttpFoundation/SessionStorage/PdoSessionStorage.php
	tests/Symfony/Tests/Bridge/Doctrine/Logger/DbalLoggerTest.php
2012-12-11 11:33:11 +01:00
Fabien Potencier
a7cd5f54ef fixed CS 2012-12-11 11:27:06 +01:00
Bart van den Burg
e6bb156f48 remove realpath call
I'm trying to create an executable phar archive from a Symfony application, but when I run the phar, it fails to find any commands because of this php bug/feature:

https://bugs.php.net/bug.php?id=52769

After this change, my archive works just like a normal app/console call
2012-12-11 11:18:21 +01:00
Fabien Potencier
f25750e378 merged branch symfony/deprecated (PR #6232)
This PR was squashed before being merged into the master branch (closes #6232).

Commits
-------

7428bf9 [WebProfilerBundle] Some eye candy for deprecated calls

Discussion
----------

[WebProfilerBundle] Some eye candy for deprecated calls

![Ohhh](https://lh4.googleusercontent.com/-T9DKsHWf4YU/UMIRqT0g_II/AAAAAAAAJ84/tRDRP8IMwRM/s840/stack.jpg).

@fabpot is [`|raw`](https://github.com/symfony/symfony/pull/new/deprecated#L0R117) a twig defect ?

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

by Baachi at 2012-12-08T09:12:12Z

Really nice 👍

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

by vicb at 2012-12-11T10:00:24Z

should be ready now
2012-12-11 11:14:29 +01:00
Victor Berchet
7428bf9aa4 [WebProfilerBundle] Some eye candy for deprecated calls 2012-12-11 11:14:29 +01:00
Fabien Potencier
d6a402a283 [Security] fixed path info encoding (closes #6040, closes #5695) 2012-12-11 10:40:23 +01:00
Fabien Potencier
47dfb9cb6a [HttpFoundation] added some tests for the previous merge and removed dead code (closes #6037) 2012-12-11 10:29:13 +01:00
Florin Patan
1ab492394c Improved Cache-Control header when no-cache is sent 2012-12-11 10:22:17 +01:00
Fabien Potencier
de44087bfd merged branch bamarni/display-errors (PR #6259)
This PR was merged into the master branch.

Commits
-------

5d98fb1 [HttpKernel] ExceptionHandler is actually displaying PHP errors

Discussion
----------

[HttpKernel] ExceptionHandler is actually displaying all PHP errors

So there is no need to set display_errors to true in that case.

Partially fixes #6254.
2012-12-11 10:05:21 +01:00
Fabien Potencier
fe194cb03f merged branch hason/tests_2_2 (PR #6202)
This PR was merged into the master branch.

Commits
-------

abe244f [TwigBundle] Fixed tests on windows

Discussion
----------

[TwigBundle] Fixed tests on windows
2012-12-11 09:58:49 +01:00
Joseph Bielawski
d5426f0a76 [Form] Add tests to prove that label is not rendered when is marked as false 2012-12-11 09:55:44 +01:00
Fabien Potencier
e3ef9368df [FrameworkBundle] tweaked previous merge 2012-12-11 09:31:58 +01:00
Fabien Potencier
57b8447ae1 merged branch dantleech/twig_loader_pass (PR #6171)
This PR was merged into the master branch.

Commits
-------

f48b22a Added configuration pass that adds Twig Loaders

Discussion
----------

[Twig] [DI Pass] Added configuration pass that adds Twig Loaders

Bug fix: [no]
Feature addition: [yes]
Backwards compatibility break: [no]
Symfony2 tests pass: [yes]
Todo: Documentation?
License of the code: MIT

- Defined new Chain loader service with symfony Filesystem loader added
  by default.
- Added compiler class which picks up any services tagged "twig.loader"
- If there are any instances of "twig.loader" the "twig.loader" alias is
  set to the Twig_Loader_Chain service ID instead of the filesystem
  loader.

I think I still like the explicitness of the other pull request, but I defer to your judgment :) This is certainly much easier for the developer.

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

by dantleech at 2012-12-03T08:31:08Z

Will update the PR later today / tomorrow

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

by dantleech at 2012-12-03T18:19:09Z

ok, updated. I throw a `Symfony\Component\DependencyInjection\Exception\LogicException` if there are no loaders -- not sure if that is the best thing to do, or if that is the best exception.

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

by fabpot at 2012-12-05T15:28:24Z

Looks good to me. Can you add a note in the CHANGELOG about this new possibility and update the documentation accordingly? Thanks.

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

by dantleech at 2012-12-05T17:50:37Z

ok. updated change log and changed both count() comparisons to be strict. @fabpot which documentation should I update? or should I add `cookbook/templating/registering_multiple_loaders.rst`?

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

by stof at 2012-12-05T20:07:37Z

@dantleech at least the DIC tags reference need to be updated to mention the new tag. I'm not sure a dedicated article is needed for it (but @weaverryan will decide if it is worth it)

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

by dantleech at 2012-12-06T17:57:20Z

Made a PR for documentation: https://github.com/symfony/symfony-docs/pull/2005

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

by dantleech at 2012-12-07T16:44:00Z

ok. have updated the correct CHANGELOG and squashed to one commit
2012-12-11 09:30:20 +01:00
Joseph Bielawski
120547c8bc [Form][TwigBridge] Don't set label attributes if is marked as not to be rendered
[Form][FrameworkBundle] Add option to disable rendering of label for fields
2012-12-11 09:29:21 +01:00
BenjaminBeck
36e4556805 [Form] Option for not displaying a label by setting label to false.
[Form] Fixed formatting & translation ..
2012-12-11 09:21:58 +01:00
Fabien Potencier
f853fc3906 removed unneeded comment 2012-12-11 09:06:32 +01:00
kaywalker
4e909bd016 Fix to allow null values in labels array 2012-12-11 09:06:04 +01:00
Bilal Amarni
5d98fb1248 [HttpKernel] ExceptionHandler is actually displaying PHP errors
Since even fatal errors are catched and turned into exceptions by
ErrorHandler, all PHP errors can nicely be displayed by
ExceptionHandler. There is no need to set display_errors to true
anymore then.

Partially fixes #6254 on github.
2012-12-10 18:52:47 +01:00
Fabien Potencier
1ec59f174e merged branch vicb/finder-adapters (PR #6253)
This PR was squashed before being merged into the master branch (closes #6253).

Commits
-------

e62b5f7 [Finder] cleanup, fixes, improvements

Discussion
----------

[Finder] cleanup, fixes, improvements
2012-12-10 14:52:40 +01:00
Victor Berchet
e62b5f78af [Finder] cleanup, fixes, improvements 2012-12-10 14:52:39 +01:00
Fabien Potencier
d665584de9 merged branch hason/patch-1 (PR #6222)
This PR was merged into the master branch.

Commits
-------

e458600 [DependencyInjection] Add deleted argument in Extension::processConfiguration

Discussion
----------

[DependencyInjection] Add deleted argument in Extension::processConfigur...

...ation
2012-12-10 13:48:09 +01:00
Fabien Potencier
a1734ddf72 Revert "merged branch gajdaw/finder_splfileinfo_fpassthu (PR #4751)" (closes #6224)
This reverts commit 5608c0c3ee, reversing
changes made to 38c30b71bd.

Conflicts:
	src/Symfony/Component/Finder/SplFileInfo.php
2012-12-10 13:46:54 +01:00
Fabien Potencier
0e2370e65e merged branch Tobion/patch-1 (PR #6237)
This PR was merged into the master branch.

Commits
-------

76e5bce no need to set the compiled route to null when cloning

Discussion
----------

[Routing] no need to set the compiled route to null when cloning

The compiled reference can be reused when cloning. When the route is changed, the compiled reference is set to null anyway. So if you just clone the route, this improves performance as it does not need to recompile.
2012-12-10 13:43:10 +01:00
Denis Gorbachev
9cf1d142b2 Fixed a typo 2012-12-10 13:42:21 +01:00
Patrick Allaert
9e4681963d Fixed: HeaderBag::parseCacheControl() not parsing quoted zero correctly
When having a Cache-Control header like:

    max-age="0"

isset($match[2]) is true but $match[2] containing: "0", it is evaluated
as false and 'true' will be set to "max-age" entry instead of "0".
2012-12-10 13:41:09 +01:00
Fabien Potencier
d63a317b21 merged branch vicb/finder (PR #6249)
This PR was merged into the master branch.

Commits
-------

cc0be8e [Finder] fluid, calling in() not required after append()

Discussion
----------

[Finder] fluid, calling in() not required after append()
2012-12-10 13:39:22 +01:00
Victor Berchet
cc0be8edf2 [Finder] fluid, calling in() not required after append() 2012-12-10 09:52:01 +01:00
Fran Moreno
a37e5e323b [Form] Fix const inside an anonymous function 2012-12-09 23:59:18 +01:00
Tobias Schultze
76e5bce801 no need to set the compiled route to null when cloning 2012-12-07 22:24:45 +01:00
dantleech
f48b22a44e Added configuration pass that adds Twig Loaders
- Added compiler class which picks up any services tagged "twig.loader"
- If there is one loader registered we set the alias to this loader
- If there is more than one we set the alias to a chain loader and all
  the loaders to it
- If there is no loaders we throw an Exception
2012-12-07 17:39:55 +01:00
Fabien Potencier
74c8b0150a merged branch bschussek/issue6141_2 (PR #6217)
This PR was merged into the 2.1 branch.

Commits
-------

6e7e08f [Form] Fixed the default value of "format" in DateType to DateType::DEFAULT_FORMAT if "widget" is not "single_text"

Discussion
----------

[Form] Fixed the "format" option in DateType

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

This PR fixes a regression introduced in #4839. To quote that PR:

> This PR changes DateType and DateTimeType to support HTML5 by default when setting the option "widget" to "single_text".

In reality, the "format" option now defaults to the HTML5 format always, not just when "widget" is "single_text". This is fixed here.

The second commit in this PR removes special characters between select/text fields. What, with German locale, was

```
<day input>.<month input>.<year input>
```

before is now

```
<day input><month input><year input>
```

This is the way date fields are represented on the majority of websites. If you *need* separators, you can have them by setting the "format" option to a custom value:

```php
$builder->add('myDate', 'date', array(
    'format' => 'dd.MM.yyyy',
));
```

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

by fabpot at 2012-12-07T08:52:21Z

The second commit should probably be done on master and it changes the behavior.

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

by bschussek at 2012-12-07T12:23:22Z

Ok, I removed the second commit now and removed the entries from the CHANGELOG.
2012-12-07 14:34:54 +01:00
Martin Hasoň
8bb3208ab8 [Config] Loader::import must return imported data 2012-12-07 14:24:02 +01:00
Bernhard Schussek
ca5d9acb19 [DoctrineBridge] Fixed caching in DoctrineType when "choices" or "preferred_choices" is passed 2012-12-07 13:39:00 +01:00
Bernhard Schussek
6e7e08f8c4 [Form] Fixed the default value of "format" in DateType to DateType::DEFAULT_FORMAT if "widget" is not "single_text" 2012-12-07 13:22:37 +01:00
Martin Hasoň
e4586007dc [DependencyInjection] Add deleted argument in Extension::processConfiguration 2012-12-07 11:34:49 +01:00
Fabien Potencier
79b4ca686e merged branch lsmith77/pre_process_app_config (PR #5566)
This PR was merged into the master branch.

Commits
-------

d7a1154 make it possible for bundles extensions to prepend settings into the application configuration of any Bundle

Discussion
----------

[2.2] add possibility for bundles extensions to prepend the app configs

Bug fix: #4652
Feature addition: yes
Backwards compatibility break: no
Symfony2 tests pass: yes
License of the code: MIT

As can be seen in the patch the extensions that should prepend the configuration are enabled automatically if they implement ``PrependExtensionInterface``.

Just as an example, here an extension, which checks if SonataAdminBundle is available and if not disables integration with it in several Bundles. It also sets some default settings for ``document_class`` and ``default_document_manager_name``:
```
diff --git a/DependencyInjection/SymfonyCmfCoreExtension.php b/DependencyInjection/SymfonyCmfCoreExtension.php
index 9f92410..c0a8dbb 100644
--- a/DependencyInjection/SymfonyCmfCoreExtension.php
+++ b/DependencyInjection/SymfonyCmfCoreExtension.php
@@ -3,11 +3,12 @@
 namespace Symfony\Cmf\Bundle\CoreBundle\DependencyInjection;

 use Symfony\Component\HttpKernel\DependencyInjection\Extension;
+use Symfony\Component\\DependencyInjection\PrependExtensionInterface;
 use Symfony\Component\DependencyInjection\ContainerBuilder;
 use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
 use Symfony\Component\Config\FileLocator;

-class SymfonyCmfCoreExtension extends Extension
+class SymfonyCmfCoreExtension extends Extension implements PrependExtensionInterface
 {
     public function load(array $configs, ContainerBuilder $container)
     {
@@ -15,4 +16,45 @@ class SymfonyCmfCoreExtension extends Extension
         $loader->load('config.xml');
         $loader->load('services.xml');
     }
+
+    public function prepend(ContainerBuilder $container)
+    {
+        $bundles = $container->getParameter('kernel.bundles');
+        if (!isset($bundles['SonataDoctrinePHPCRAdminBundle'])) {
+            // disable SonataDoctrinePHPCRAdminBundle admin support in Bundles
+            $config = array('use_sonata_admin' => false);
+            foreach ($container->getExtensions() as $name => $extension) {
+                switch ($name) {
+                    case 'symfony_cmf_menu':
+                    case 'symfony_cmf_routing_extra':
+                    case 'symfony_cmf_simple_cms':
+                        $container->prependExtensionConfig($name, $config);
+                        break;
+                }
+            }
+        }
+
+        // process the configuration of SymfonyCmfCoreExtension
+        $configs = $container->getExtensionConfig($this->getAlias());
+        $config = $this->processConfiguration(new Configuration(), $configs);
+        // add the default configs to various Bundles
+        foreach ($container->getExtensions() as $name => $extension) {
+            switch ($name) {
+                case 'symfony_cmf_content':
+                case 'symfony_cmf_simple_cms':
+                    $container->prependExtensionConfig($name, $config);
+                    break;
+                }
+        }
+    }
 }
```

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

by stof at 2012-09-21T21:10:00Z

I think you are giving too much power to bundles here: a bundle becomes able to modify all the config defined explicitly by the user if it wants to do it.

I think it would be safer to give them the possibility to load an additional config file which would be prepended (so that user-defined config would still win). Giving the ability to load files means passing the loader used by the kernel, and it should then be called before calling the load method on the kernel itself (to respect the order of loaded files)

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

by lsmith77 at 2012-09-22T05:50:08Z

Not sure how a config file helps solve anything. I mean they can load as many config files as they want already. The key is being able to automatically apply configuration to multiple Bundles as well as enabling/disabling features based on if certain Bundles are registered.

BTW the end result in my examples is also prepended, so that user config wins. However yes this would be up to the person implementing the Bundle. We could however provide a dedicated method for prepending in addition to or instead of ``setExtensionConfig``.

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

by stof at 2012-09-22T11:40:29Z

@lsmith77 If you can load a file with the main loader, this file can provide some app-level configuration (be it for your own bundle or others).
And your code example is indeed prepending. But imagine what would occur when someone uses this feature without knowing well how the component works: he will likely call ``setExtensionConfig`` in a first implementation, thus dropping all userland config for the bundle. Your setup does not only allow to make a file win over the userland config but makes it even easier to remove the userland config.

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

by lsmith77 at 2012-09-22T18:11:29Z

but i dont get how that would help. the point is to be able for one bundle to configure other bundles before the load as this is obviously alot cleaner than trying to do the same via a compiler pass. so imho this is what is needed to encourage decoupled bundles. otherwise for example CMS or other reuseable and extensible apps will be forced to always put everything in one bundle.

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

by stof at 2012-09-22T19:23:45Z

@lsmith77 I agree about the feature, not about the way to implement it. If you allow bundles to load a file as it it were some app-level config, they would become able to provide some config for other bundles (and you could load several files depending of which bundles are enabled), but without allowing bundles to remove the userland config.

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

by lsmith77 at 2012-09-22T19:50:19Z

sorry but i dont understand what you suggest. more over i dont see the problem. its already possible to seriously break stuff with compiler passes which cannot be easily enabled/disabled. this is just convenience. if it doesnt work because of some obscure combo then simply dont use it for the app since it needs to be explicitly enabled in the kernel.

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

by lsmith77 at 2012-09-24T09:25:10Z

@stof thought about your comments, are you suggesting for a Bundle to be able to generate a config file that is prepended? in that case the current behavior would already be that if we change ``setExtensionConfig`` to just be a ``prependExtensionConfig`` .. however i am not sure if we really need this limitation since as i point out this would still by far be less dangerous than compiler passes and also i expect this to be used mainly by open source applications on top of Symfony2 rather than standard bundles.

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

by lsmith77 at 2012-10-13T13:28:29Z

@lolautruche i also think this is relevant for you guys. this way you could start preconfiguring 3rd party bundles as part of your main ezPublish bundle.

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

by lolautruche at 2012-10-13T13:57:09Z

While I suspect a nice feature, the implementation looks obscure to me...

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

by lsmith77 at 2012-10-13T17:43:02Z

The implementation of the example extension or the implementation of the actual changes proposed in this PR?

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

by lolautruche at 2012-10-13T17:46:57Z

The example, sorry 😃

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

by lsmith77 at 2012-10-13T17:50:38Z

The example was fairly quickly hacked together. The basic thing you need to do is fetch the config for the bundle you want to change, manipulate the config (usually by appending an array to the array of configs so that you dont affect explicit configuration) and then set it again.

As I explained to @stof it would alternative/additionally be possible to support a method that pushes a config array to the top of the array of config stack. Such a method might make the necessary code simpler.

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

by stof at 2012-10-13T21:39:07Z

@fabpot what do you think about it ?

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

by jrobeson at 2012-10-20T15:45:18Z

I've been porting much of an existing framework over to use more symfony components and bundles. I think that this might help some of the problems i've been having. I would really appreciate some better examples as how to one would use it  (same for the cmf router, but that's another story).

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

by lsmith77 at 2012-10-21T07:28:52Z

not really sure what other examples i could give. the process is quite simple:
1) determine what configuration options to add to other Bundles

for example with the following code I determine that SonataAdmin for PHPCR is not installed (which means i should disable using it in other Bundles):
```
$bundles = $container->getParameter('kernel.bundles');
if (!isset($bundles['SonataDoctrinePHPCRAdminBundle'])) {
```

alternatively I could simply already process the configuration and then pick all or some of these configuration options:
```
$configs = $container->getExtensionConfig($this->getAlias());
$config = $this->processConfiguration(new Configuration(), $configs);
```

2) then add these configuration to what other Bundles I feel should get these options

usually I will add these to the top of the config array stack. this means that if the user would manually set the same setting in most cases the user setting will override what the pre-processor set.
```
$container->unshiftExtensionConfig($name, array('use_sonata_admin' => false));
```

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

by lsmith77 at 2012-10-24T12:52:38Z

added ``ContainerBuilder::unshiftExtensionConfig`` since this is the usual use case. with this method added it could be discussed if ``ContainerBuilder::setExtensionConfig`` is still needed or not.

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

by lsmith77 at 2012-11-24T14:48:44Z

I spoke to @fabpot today and he said that since this patch just allows you to set defaults and not really "process" the actual configuration I shouldn't call it "preProcess" so I renamed it to "prepend".

Furthermore as its just prepending @fabpot said there isnt really a need to require manually enabling it, so here is a patch to auto-enable the prepending logic:
```
diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php
index b890fbf..7374b87 100644
--- a/src/Symfony/Component/HttpKernel/Kernel.php
+++ b/src/Symfony/Component/HttpKernel/Kernel.php
@@ -701,8 +701,8 @@ abstract class Kernel implements KernelInterface, TerminableInterface
      */
     protected function prependExtensionConfigs(ContainerBuilder $container)
     {
-        foreach ($this->getPrependingExtensions() as $name) {
-            $extension = $container->getExtension($name);
+        foreach ($this->bundles as $bundle) {
+            $extension = $bundle->getContainerExtension();
             if ($extension instanceof PrependExtensionInterface) {
                 $extension->prepend($container);
             }
@@ -710,16 +710,6 @@ abstract class Kernel implements KernelInterface, TerminableInterface
     }

     /**
-     * Returns the ordered list of extensions that may prepend extension configurations.
-     *
-     * @return array
-     */
-    protected function getPrependingExtensions()
-    {
-        return array();
-    }
-
-    /**
      * Gets a new ContainerBuilder instance used to build the service container.
      *
      * @return ContainerBuilder
```

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

by lsmith77 at 2012-11-25T19:31:01Z

ok .. i pondered the code some more and now i have enabled registering of the prepending extensions by default, since its now quite easy to just override the ``prependExtensionConfigs()`` method since there is almost no logic in there anymore.

@fabpot i am not 100% sure with the naming yet ..

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

by lsmith77 at 2012-12-05T14:03:43Z

@fabpot if you are ok with the PR as it is now, i can do the rebase so you can merge this?

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

by lsmith77 at 2012-12-05T18:30:29Z

@fabpot all good now? then i will squash the commits ..

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

by lsmith77 at 2012-12-05T18:34:50Z

actually looking at the full change set again i am no longer sure if it makes sense to have ``PrependExtensionInterface`` in the DI rather than the HttpKernel.

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

by lsmith77 at 2012-12-07T09:21:14Z

@fabpot all good now?

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

by fabpot at 2012-12-07T09:37:52Z

The code looks good to me now. There are two remaining task before merging:

* Is it something we need to add somewhere in the documentation?
* Can you add a note in the DI component CHANGELOG?

Thanks.

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

by lsmith77 at 2012-12-07T09:49:17Z

i have added a changelog entry and squashed the commits.
i will also work on a documentation entry, i guess i will make it a cookbook entry. not sure if it should be included in http://symfony.com/doc/2.0/cookbook/bundles/extension.html .. but imho it would better be a separate entry.
2012-12-07 11:04:59 +01:00