Commit Graph

8324 Commits

Author SHA1 Message Date
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
Fabien Potencier
687703db94 merged branch canni/command_in_process (PR #2894)
Commits
-------

e9b4c58 [Console] Enable process isolantion in Shell

Discussion
----------

[Console] Enable process isolantion in Shell

Bug fix: no
BC break: no
Feature addition: yes
Symfony2 test pass: yes
Fixes the following tickets: #2848 #2847
Todo: Write unit tests

See tickets for reference, need help with unit testing, because I don't know how to test this :)

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

by canni at 2011-12-16T09:36:32Z

I've tested this with different scenarios like "inception" (invoking shell from shell - will not work) ;) and others, everything seems to work great.

As I have no idea on how to pack this with unit testing some help needed, also as I don't have any windows in home ;) need someone to test it on MS os.
And we should decide, do we want process isolation by default? (This will not break the BC, break only the "expected behavior" - colorful output and "interactivity")

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

by canni at 2011-12-18T15:14:26Z

I've rebased this branch to match current `HEAD` and I've added usage of new process builder, for better portability an shell arg escaping.

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

by fabpot at 2012-02-02T08:28:32Z

@canni: Can you squash your commits before I merge this PR? Thanks.

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

by canni at 2012-02-02T09:07:16Z

@fabpot @stof done.
2012-02-02 10:13:02 +01:00
Fabien Potencier
5596f79c13 merged branch bschussek/changelog-fixes (PR #3248)
Commits
-------

6fefe0a [Form] Improved the CHANGELOG

Discussion
----------

[Form] Improved the CHANGELOG
2012-02-02 10:12:10 +01:00
Martin Hasoň
7cecb4e71e [Form] added support for parent of FormBuilder 2012-02-02 10:09:50 +01:00
Fabien Potencier
0f86c4585d merged branch havvg/acl-unset-parent-master (PR #3222)
Commits
-------

6a02237 add note on BC BREAK of MutableAclInterface
dbd3a1b allow unsetting parentAcl on MutableAclInterface

Discussion
----------

[Security] allow unsetting the parent ACL

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

The #3151 rebased onto master.
Sorry for the delay, was on vacations.

```plain
 symfony2 git:acl-unset-parent ✔  phpunit tests/Symfony/Tests/Component/Security         ~/Web Development/symfony2
PHPUnit 3.6.4 by Sebastian Bergmann.

Configuration read from /Users/havvg/Web Development/symfony2/phpunit.xml

...............................................................  63 / 428 ( 14%)
............................................................... 126 / 428 ( 29%)
............................................................... 189 / 428 ( 44%)
............................................................... 252 / 428 ( 58%)
............................................................... 315 / 428 ( 73%)
............................................................... 378 / 428 ( 88%)
.................................................

Time: 15 seconds, Memory: 49.00Mb

OK (427 tests, 1180 assertions)
```
2012-02-02 10:09:03 +01:00
Dariusz Górecki
e9b4c584c0 [Console] Enable process isolantion in Shell
Bug fix: no
BC break: no
Feature addition: yes
Symfony2 test pass: yes
Fixes the following tickets: #2848 #2847
Todo: -

See tickets for reference, need help with testing, because I don't know how to test this :)
2012-02-02 10:09:00 +01:00
Fabien Potencier
e71d1579d1 merged branch helmer/readonly (PR #3193)
Commits
-------

de253dd [Form] read_only and disabled attributes

Discussion
----------

[Form] read_only and disabled attributes (closes #1974)

1. Removed ``readOnly`` property from ``Form``, as it is no longer required
2. Introduced ``disabled`` property to ``Form``, behaves exactly like ``readOnly`` used to
3. Added ``disabled`` property to fields, defaults to ``false``, renders as ``disabled="disabled"``
4. A field with positive ``read_only`` property now renders as ``readonly="readonly"``

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

by helmer at 2012-01-26T17:46:17Z

I changed ``Form`` and ``FormBuilder`` property ``readOnly`` to ``disabled``. On second thought, this is perhaps not such good change - while readOnly somewhat implied the use-case, disabled no longer does.

Perhaps something else, like ``bindable`` (as not to confuse with read_only attribute of Fields)?

@bschussek, others, any thoughts?

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

by bschussek at 2012-01-31T06:53:59Z

Please prefix commits with the affected component, if applicable.

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

by helmer at 2012-01-31T08:41:03Z

@bschussek Prefixed. Please also see see to [this question](https://github.com/symfony/symfony/pull/3193#issuecomment-3673074)
2012-02-02 10:03:00 +01:00
Bernhard Schussek
6fefe0a6fb [Form] Improved the CHANGELOG 2012-02-02 10:02:49 +01:00
Fabien Potencier
9fa3201c11 removed unneeded code 2012-02-02 10:00:42 +01:00
Fabien Potencier
048fc2f6b9 merged branch ManuelKiessling/ticket_3124 (PR #3188)
Commits
-------

6090dee [FormType] Adopted MoneyTypeTest::testMoneyPatternWorksForYen to CS
e814d27 [FormType] Fixed broken MoneyType regexp for JPY

Discussion
----------

[Bugfix][Form] Fixed broken MoneyType regexp for JPY

Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: ![Build Status](https://secure.travis-ci.org/ManuelKiessling/symfony.png?branch=ticket_3124) Fixes the following tickets: #3124
Todo: -

The regexp in MoneyType doesn't work if currency format has no decimal
(like JPY) and doesn't work either if the currency symbol is unicode

This change fixes both issues and adds a unit test
2012-02-02 09:59:01 +01:00
Sebastian Bergmann
253a8ff016 [DependencyInjection] split a test 2012-02-02 09:51:16 +01:00
Fabien Potencier
1c3e6c2cb2 merged branch sellingsource/EXPOSE_FORM_VALIDATORS (PR #2983)
Commits
-------

601d462 [Form] Added getValidators() to Form class

Discussion
----------

[Form] Added getValidators() to Form class

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

I am working implementing client side validation in a bundle that adds validation rules via a form builder. I am currently unable to pull the validators from the Form class which is making the implementation incredibly difficult.

I noticed that the transformers are currently exposed and based on some feedback I got on IRC I am guessing these weren't exposed simply because no one needed them at the time.

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

by mlively at 2011-12-28T20:54:41Z

Side note: It would be incredibly helpful to have this in the current branch of symfony. I implemented it on master because it is a new feature, but I would be more than happy to patch it into 2.0 if you would like.

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

by canni at 2012-01-11T10:15:46Z

👍

As this is new feature it cannot fit into 2.0 series, but 2.1 is just few clicks ahead, maybe this feature will  fit into  ;)

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

by bschussek at 2012-01-31T08:23:05Z

ping @fabpot
👍

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

by stof at 2012-01-31T08:51:26Z

@mlively could you rebase your branch ? it conflicts with the current master

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

by mlively at 2012-01-31T21:38:39Z

Yes, I can do that might be later today.
2012-02-02 09:36:07 +01:00
Fabien Potencier
b048596e3d merged branch drublic/master (PR #3242)
Commits
-------

2374e54 Break paths in exceptions hard with css if necessary

Discussion
----------

Exceptions: Break source-paths with CSS

Sometimes in exceptions absolute paths of files are pretty long and need more than one line.

eg.: `/Volumes/Macintosh HD/Users/blabla/Sites/project/files/src/SomeProjectsName/SomeProjectsNameFrontendBundle/Controller/CreateController.php`

This should be displayed within the width of the `h1`.

Using CSS `word-break: break-all;`.
2012-02-02 09:16:47 +01:00
Fabien Potencier
42dbdd9f3d merged branch ericclemmons/3194-router-prefix-imports (PR #3245)
Commits
-------

534843d Updated CHANGELOG-2.1 to reflect imported route support of default values and requirements
3c28ab7 No prefix is required to override imported RouteCollections
c373d5b Added RouteCollectionTest#testAddCollectionOverridesDefaultsAndRequirements

Discussion
----------

[Router] RouteCollection `prefix` optional for default values/requirements

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

[![Build Status](https://secure.travis-ci.org/ericclemmons/symfony.png)](https://secure.travis-ci.org/ericclemmons/symfony.png)

With the commit 2e1344eb7e (thanks @vicb!), imported routes could have `defaults` and `requirements` set, but only as long as there is a `prefix`.

Thisfix allows any imported route to have defaults set, whether or not `prefix` is set.

(See #3194 for specifics)

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

by vicb at 2012-02-02T06:01:51Z

Behavior is now consistent.

_FYI, You should thank `git-dag` here, `gitk` & `git-cola` are also helpful to filter commits._
2012-02-02 07:50:10 +01:00
Eric Clemmons
534843de51 Updated CHANGELOG-2.1 to reflect imported route support of default values and requirements 2012-02-01 21:14:51 -08:00
Eric Clemmons
3c28ab7abd No prefix is required to override imported RouteCollections 2012-02-01 21:10:50 -08:00
Eric Clemmons
c373d5b656 Added RouteCollectionTest#testAddCollectionOverridesDefaultsAndRequirements 2012-02-01 21:10:50 -08:00
drublic
2374e54e1c Break paths in exceptions hard with css if necessary
Using `word-break: break-all;`

Signed-off-by: drublic <hans@sa-designz.de>
2012-02-01 23:13:45 +01:00