Commit Graph

8396 Commits

Author SHA1 Message Date
grizlik
b65a9972fb [Form] Added test ChoiceList::testGetChoicesForValuesCorrectOrderingOfResult for correct ordering check 2012-02-04 14:14:29 +04:00
Fabien Potencier
6e60967827 [DoctrineBridge] fixed a unit test after the 2.0 merge 2012-02-04 08:08:27 +01:00
Fabien Potencier
b1148e334f merged 2.0 2012-02-04 08:03:45 +01:00
Fabien Potencier
79a957be77 merged branch kbond/config_dump_command (PR #3187)
Commits
-------

4847d3a renamed command
e97af0b code fixes
df94282 [FrameworkBundle] removed unnecessary DebugCommand
fa32885 [SecurityBundle] added configuration info
2f8ad93 [MonologBundle] added configuration info
9757958 [FrameworkBundle] added configuration info
58939f1 [TwigBundle] added configuration docs
8dc40e4 [FrameworkBundle] added config:dump console command

Discussion
----------

Config dump command

Bug fix: no
Feature addition: yes
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: #1663
Todo: add more config info/examples

[![Build Status](https://secure.travis-ci.org/kbond/symfony.png?branch=config_dump_command)](http://travis-ci.org/kbond/symfony)

This is a config dump command based on the additions of PR #1099.  This was initially part of that PR and there is some discussion there about it (https://github.com/symfony/symfony/pull/1099)

### Usage:

1. dump by root node: ``app/console config:dump framework``
2. dump by bundle name: ``app/console config:dump FrameworkBundle``

A few issues/notes:

* Only dumps to yaml
* Only 1 configuration per bundle (this was brought by @stof here: https://github.com/symfony/symfony/pull/1099#issuecomment-1242993)
* Works out of the box for most bundles but not ones that use a non-standard ``Configuration`` class (such as the assetic bundle).  In this case ``Extension::getConfiguration()`` must be configurated.

I have used it to create some (most) of the config reference docs.  It works fine but I find it somewhat crude, any suggestions to improve it would be appreciated.

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

by kbond at 2012-01-24T21:00:43Z

Few more issues:

1. Should I abstract the logic to a "normalizer" class that converts the Configuration class into a manageable array?  I struggle with this idea because isn't that what ``TreeBuilder`` basically is?
2. @stof made a good point that ``config:dump`` doesn't really describe what this does.  Would dumping your config be useful?  Perhaps ``config:dump framework`` dumps the config for your project while ``config:dump --ref framework`` dumps the default reference?

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

by stof at 2012-01-24T21:18:15Z

@kbond you cannot really dump the config. Part of it does not go through these extensions at all. And it does not make much sense anyway IMO.
the command as is does the right job IMO (i.e. dumping a reference for the extension). But its name should be improved

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

by kbond at 2012-01-24T21:20:51Z

``config:reference`` perhaps?

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

by fabpot at 2012-02-02T10:05:19Z

This command is about displaying the default configuration for a given bundle. So, what about `config:dump-reference`? As I understand, the command name is the last element to figure out before merging, right?

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

by stof at 2012-02-02T10:19:49Z

@fabpot indeed.

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

by stof at 2012-02-02T10:34:16Z

and +1 for ``config:dump-reference``

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

by Tobion at 2012-02-02T12:08:03Z

why not use the words you chose yourself: `config:dump-default`
I think it's more explicit.
2012-02-04 08:01:13 +01:00
Fabien Potencier
5251177002 merged branch helmer/readonly_fix (PR #3258)
Commits
-------

8321593 [Form] DRYed ChoiceType
0753cee [Form] Fixed read_only attribute for expanded fields

Discussion
----------

[Form] Fixed read_only attribute for expanded fields

Expanded choice widgets lose the knowledge of read_only attribute value.

Fixes bug introduced by #3193

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

by helmer at 2012-02-02T16:24:50Z

Please hold before merging, @bschussek had some thoughts about my changes in ``ChoiceType``, waiting for feedback.

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

by bschussek at 2012-02-02T16:33:12Z

I'm fine with the refactoring then, but please split it into two commits at least. The changes in ChoiceType have nothing in common with the actual issue here.

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

by helmer at 2012-02-02T19:40:39Z

Tests added.

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

by bschussek at 2012-02-03T10:14:32Z

Great, thanks.

@fabpot 👍
2012-02-04 07:59:57 +01:00
Fabien Potencier
c9e87491b4 merged branch stof/unescape_paramaters (PR #3260)
Commits
-------

a7b48c0 Renamed the method
8e13095 Fixed the unescaping of parameters to handle arrays
045f936 Changed the testcase to expect the unescaping only after the resolution
a1b6d4c Added a failing testcase for escaped % in array parameters

Discussion
----------

Unescape paramaters

This fixes the unescaping of % in parameters when it is used in an array.

It is a replacement for @lsmith77's work done in #3241 but with a working fix this time :)
2012-02-04 07:58:12 +01:00
Fabien Potencier
ffef177c4a merged branch willdurand/fix-propel-bridge (PR #3266)
Commits
-------

3c227fd [Propel] Fixed naming due to changes in #87b16e7015c02e794c33dbfc05812cf070b4ac68

Discussion
----------

[Propel] Fixed naming due to changes in #87b16e7015c02e794c33dbfc05812cf070b4ac68

+ minor CS fix

I'll provide unit tests for the Propel bridge in a separate PR.
2012-02-04 07:43:54 +01:00
William DURAND
3c227fdd74 [Propel] Fixed naming due to changes in #87b16e7015c02e794c33dbfc05812cf070b4ac68
+ minor CS fix
2012-02-03 23:06:29 +01:00
Sebastian Hörl
411a0ccbdd [Validator] Added GroupSequenceProvider to changelog 2012-02-03 17:45:10 +01:00
grizlik
a60daffb47 [Form] Fixed incorrect sorting in ChoiceList::getChoicesForValues 2012-02-03 14:21:24 +04:00
Helmer Aaviksoo
8321593c85 [Form] DRYed ChoiceType 2012-02-03 11:49:06 +02:00
Helmer Aaviksoo
0753cee11a [Form] Fixed read_only attribute for expanded fields 2012-02-03 11:49:06 +02:00
Sebastian Hörl
815c769292 [Validator] Renamed getValidationGroups to getGroupSequence 2012-02-02 20:27:50 +01:00
Sebastian Hörl
d84a2e4bdf [Validator] Updated test expectations 2012-02-02 20:27:50 +01:00
Sebastian Hörl
9f2310b2f8 [Validator] Fixed typos, renamed hasGroupSequenceProvider 2012-02-02 20:27:50 +01:00
Sebastian Hörl
e0d28284fc [Validator] GroupSequenceProvider tests improved, configuration changed 2012-02-02 20:27:50 +01:00
Sebastian Hörl
c3b04a3336 [Validator] Changed GroupSequenceProvider implementation 2012-02-02 20:27:50 +01:00
Sebastian Hörl
6c4455fef7 [Validator] Added GroupSequenceProvider 2012-02-02 20:27:49 +01:00
Christophe Coevoet
a7b48c058b Renamed the method 2012-02-02 18:59:53 +01:00
Christophe Coevoet
8e13095e5c Fixed the unescaping of parameters to handle arrays 2012-02-02 18:34:11 +01:00
Christophe Coevoet
045f936038 Changed the testcase to expect the unescaping only after the resolution
String values are not unescaped either in resolveValue() because it can
be called several times for the same parameter.
2012-02-02 18:34:05 +01:00
lsmith77
a1b6d4c46b Added a failing testcase for escaped % in array parameters 2012-02-02 18:33:55 +01:00
kbond
4847d3ad35 renamed command 2012-02-02 11:47:41 -05:00
Fabien Potencier
2cd246786d merged branch bschussek/issue3239 (PR #3256)
Commits
-------

8714d79 [Form] Simplified code in MergeCollectionListener
8ab982a [Form] Fixed: Custom add and remove method are not invoked if disallowed
02f61ad [Form] Renamed choice and collection options "adder_prefix" and "remover_prefix" to "add_method" and "remove_method" and allowed to specify full method names
b393774 [Form] Used direct method access in MergeCollectionListener instead of Reflection to avoid problems when using class hierarchies
d208f4e [Form] Made it possible to use models with only either addXxx() or removeXxx()

Discussion
----------

[Form] Fixed edge cases in MergeCollectionListener

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

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

Fixes an issue mentioned in the comments of #3239

see https://github.com/symfony/symfony/pull/3239#issuecomment-3776312

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

by bschussek at 2012-02-02T12:12:17Z

Wait a minute before merging this.

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

by bschussek at 2012-02-02T13:01:55Z

@fabpot Ready to merge
2012-02-02 17:28:40 +01:00
Fabien Potencier
df2ad15768 merged branch bschussek/issue2861 (PR #3257)
Commits
-------

bd461e2 [Form] Forms now don't create empty objects anymore if they are completely empty and not required. The empty data for these forms is null.

Discussion
----------

[Form] Forms now don't create empty objects anymore if they are empty and not required

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

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

If a form (or a nested form) is left completely empty upon submission and is not required, no new data object will be generated anymore. Instead, the form returns null as data.
2012-02-02 17:23:50 +01:00
Bernhard Schussek
8714d7924e [Form] Simplified code in MergeCollectionListener 2012-02-02 14:45:39 +01:00
Bernhard Schussek
bd461e295d [Form] Forms now don't create empty objects anymore if they are completely empty and not required. The empty data for these forms is null. 2012-02-02 14:40:19 +01:00
Kevin Bond
e97af0bac0 code fixes 2012-02-02 08:20:37 -05:00
kbond
df94282dab [FrameworkBundle] removed unnecessary DebugCommand 2012-02-02 08:20:37 -05:00
kbond
fa32885ea3 [SecurityBundle] added configuration info 2012-02-02 08:20:37 -05:00
kbond
2f8ad93db8 [MonologBundle] added configuration info 2012-02-02 08:20:37 -05:00
kbond
97579587c1 [FrameworkBundle] added configuration info 2012-02-02 08:20:37 -05:00
kbond
58939f16f3 [TwigBundle] added configuration docs 2012-02-02 08:20:37 -05:00
kbond
8dc40e4d29 [FrameworkBundle] added config:dump console command 2012-02-02 08:20:37 -05:00
Bernhard Schussek
8ab982afc8 [Form] Fixed: Custom add and remove method are not invoked if disallowed 2012-02-02 13:53:44 +01:00
Bernhard Schussek
02f61adcc5 [Form] Renamed choice and collection options "adder_prefix" and "remover_prefix" to "add_method" and "remove_method" and allowed to specify full method names 2012-02-02 13:44:48 +01:00
Bernhard Schussek
b39377402b [Form] Used direct method access in MergeCollectionListener instead of Reflection to avoid problems when using class hierarchies 2012-02-02 12:53:47 +01:00
Bernhard Schussek
d208f4e0de [Form] Made it possible to use models with only either addXxx() or removeXxx() 2012-02-02 12:53:46 +01:00
Fabien Potencier
0914a38e74 merged branch bschussek/issue3161 (PR #3253)
Commits
-------

9a4e22e [Form] Disallowed infinity in NumberToLocalizedStringTransformer

Discussion
----------

[Form] Disallowed infinity in NumberToLocalizedStringTransformer

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

![Travis Build Status](https://secure.travis-ci.org/bschussek/symfony.png?branch=issue3161)
2012-02-02 12:27:10 +01:00
Bernhard Schussek
9a4e22efe7 [Form] Disallowed infinity in NumberToLocalizedStringTransformer 2012-02-02 12:15:50 +01:00
Fabien Potencier
c6207e4898 merged branch canni/simple_fixes (PR #3252)
Commits
-------

d02f172 Code readability fixes, removed unneeded typecasts and checks

Discussion
----------

Code readability fixes, removed unneeded typecasts and checks

Bug fix: no
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: -
Todo: -
2012-02-02 12:11:47 +01:00
Dariusz Górecki
d02f17268e Code readability fixes, removed unneeded typecasts and checks
Bug fix: no
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: -
Todo: -
2012-02-02 11:43:31 +01:00
Fabien Potencier
baa63b8077 merged branch bschussek/issue1540 (PR #3239)
Commits
-------

9b0245b [Form] Made prefix of adder and remover method configurable. Adders and removers are not called if "by_reference" is disabled.
49d1464 [Form] Implemented MergeCollectionListener which calls addXxx() and removeXxx() in your model if found
7837f50 [Form] Added FormUtil::singularify()

Discussion
----------

[Form] Forms now call addXxx() and removeXxx() in your model

Bug fix: no
Feature addition: yes
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: #1540
Todo: adapt documentation

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

Adds functionality for calling `addXxx` and `removeXxx` method in your model. All types returning a collection of values are affected: "collection", "choice" (with multiple selection) and "entity" (with multiple selection).

Example:

    class Article
    {
        public function addTag($tag) { ... }
        public function removeTag($tag) { ... }
        public function getTags($tag) { ... }
    }

And the controller:

    $form = $this->createFormBuilder($article)
        ->add('tags')
        ->getForm();

Upon modifying the form, addTag() and removeTag() are now called appropiately.

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

by stof at 2012-02-01T18:23:49Z

Really great

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

by vicb at 2012-02-01T18:24:04Z

Great !!

Two suggestions:

* make "add" and "remove" configurable,
* introduce a base class for the remove listeners with (final?) `::getSubscribedEvents()` and `::getEventPriorities()`

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

by haswalt at 2012-02-01T18:57:46Z

+1 this

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

by daFish at 2012-02-01T19:54:46Z

+1

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

by michelsalib at 2012-02-01T20:55:37Z

Can wait to have it!
It will save lots of time trying to solve WTF effects and making workarounds.

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

by bschussek at 2012-02-02T09:37:12Z

@vicb: Your first point is done. The second, I don't understand.

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

by stof at 2012-02-02T09:40:50Z

@bschussek your branch conflicts with master according to github

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

by vicb at 2012-02-02T09:52:40Z

@bschussek my point is that I can stand hard-coded priorities which are error prone. A better solution might be to introduce constants (in `FormEvents` / `FormEventPriorities` ?) with meaningful names.

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

by bschussek at 2012-02-02T10:21:52Z

@stof Rebased

@vicb I know, but who is responsible for managing priorities? There is no central entitty that can do this. (btw this is a general problem of the priority system of the EventDispatcher)

@fabpot Ready to merge.

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

by vicb at 2012-02-02T10:23:28Z

@bschussek doesn't each form has is own dispatcher so there is no need for a global registry here, something local to the form could be good enough.
2012-02-02 11:25:38 +01:00
Fabien Potencier
3c8d300125 fixed CS 2012-02-02 11:21:34 +01:00
Bernhard Schussek
9b0245b57b [Form] Made prefix of adder and remover method configurable. Adders and removers are not called if "by_reference" is disabled. 2012-02-02 11:16:57 +01:00
Bernhard Schussek
49d1464b43 [Form] Implemented MergeCollectionListener which calls addXxx() and removeXxx() in your model if found
The listener is used by the Collection type as well as the Choice and Entity type (with multiple
selection). The effect is that you can have for example this model:

    class Article
    {
        public function addTag($tag) { ... }
        public function removeTag($tag) { ... }
        public function getTags($tag) { ... }
    }

You can create a form for the article with a field "tags" of either type "collection" or "choice"
(or "entity"). The field will correctly use the three methods of the model for displaying and
editing tags.
2012-02-02 11:16:21 +01:00
Bernhard Schussek
7837f50c73 [Form] Added FormUtil::singularify() 2012-02-02 11:15:49 +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
Fabien Potencier
569b6dbd13 merged branch hason/formbuilder (PR #3249)
Commits
-------

7cecb4e [Form] added support for parent of FormBuilder

Discussion
----------

[Form] added support for parent of FormBuilder

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

In some cases of building forms, it is good to know the attributes of the parent builder. In my case I want to automaticaly add the subscriber to the fields, whose parent builder has a concrete attribute.

Replace #2882
2012-02-02 10:13:41 +01:00
Bernhard Schussek
2e4ebe444f [Validator] Renamed methods addViolationAtRelativePath() and getAbsolutePropertyPath() in ExecutionContext 2012-02-02 10:13:41 +01:00