Commit Graph

20899 Commits

Author SHA1 Message Date
Fabien Potencier
ba84ac87b8 bug #14170 Fix the AJAX profiling (stof)
This PR was merged into the 2.6 branch.

Discussion
----------

Fix the AJAX profiling

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | reported in https://github.com/symfony/symfony/issues/13447#issuecomment-88849938
| License       | MIT
| Doc PR        | n/a

The fix for IE8 (#13978) which does not have the addEventListener method on XMLHttpRequest broke the feature for modern browsers because it was checking the existence on the wrong object. It is a method on the instance, not on the "class", and so should be checked on the prototype.

Commits
-------

9d6c0b1 Fix the AJAX profiling
2015-04-02 14:16:16 +02:00
Fabien Potencier
49494771c5 minor #14164 [3.0] [Form] added missing CHANGELOG notes. (hhamon)
This PR was merged into the 3.0-dev branch.

Discussion
----------

[3.0] [Form] added missing CHANGELOG notes.

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | ~
| License       | MIT
| Doc PR        | ~

Commits
-------

37f7033 [Form] added missing CHANGELOG notes.
2015-04-02 14:13:09 +02:00
Fabien Potencier
0942f0c124 minor #14154 [VarDumper] Added missing changelog entry (dosten)
This PR was merged into the 2.7 branch.

Discussion
----------

[VarDumper] Added missing changelog entry

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Commits
-------

17d265a Added missing changelog entry
2015-04-02 14:12:01 +02:00
Fabien Potencier
637c8bba3a feature #14147 Removed deprecations in Process component (dosten)
This PR was squashed before being merged into the 3.0-dev branch (closes #14147).

Discussion
----------

Removed deprecations in Process component

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Commits
-------

8ef1960 Removed deprecations in Process component
2015-04-02 14:09:51 +02:00
Diego Saint Esteben
8ef1960a0d Removed deprecations in Process component 2015-04-02 14:09:49 +02:00
Javier Eguiluz
dbd02b0871 Use specialized config methods instead of the generic ifTrue() method 2015-04-02 13:05:24 +02:00
Christophe Coevoet
9d6c0b1c30 Fix the AJAX profiling
The fix for IE8 which does not have the addEventListener method on
XMLHttpRequest broke the feature for modern browsers because it was
checking the existence on the wrong object. It is a method on the
instance, not on the "class", and so should be checked on the prototype.
2015-04-02 11:50:50 +02:00
Fabien Potencier
8d6929b6e3 feature #14150 Removed deprecations in Templating component (dosten)
This PR was squashed before being merged into the 3.0-dev branch (closes #14150).

Discussion
----------

Removed deprecations in Templating component

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Commits
-------

c936361 Removed deprecations in Templating component
2015-04-02 08:46:35 +02:00
Diego Saint Esteben
c936361fa6 Removed deprecations in Templating component 2015-04-02 08:46:33 +02:00
Fabien Potencier
0409baa198 feature #14156 Remove deprecated Locale component (stloyd)
This PR was merged into the 3.0-dev branch.

Discussion
----------

Remove deprecated Locale component

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | yes
| Deprecations? | no
| Tests pass?   | yes
| License       | MIT

Commits
-------

4c57e77 Remove deprecated Locale component
2015-04-02 08:43:01 +02:00
Fabien Potencier
de02c5f962 bumped Symfony version to 2.6.7 2015-04-01 20:51:37 +02:00
Fabien Potencier
48c9e835a8 updated VERSION for 2.6.6 2015-04-01 18:55:26 +02:00
Fabien Potencier
4eb695a40e updated CHANGELOG for 2.6.6 2015-04-01 18:55:18 +02:00
Nicolas Grekas
06f92fc2d5 Safe escaping of fragments for eval() 2015-04-01 18:53:45 +02:00
Fabien Potencier
ec2cb961cc Merge branch '2.3' into 2.6
* 2.3:
  bumped Symfony version to 2.3.28
  updated VERSION for 2.3.27
  update CONTRIBUTORS for 2.3.27
  updated CHANGELOG for 2.3.27
  isFromTrustedProxy to confirm request came from a trusted proxy.
  Safe escaping of fragments for eval()

Conflicts:
	src/Symfony/Component/HttpFoundation/Request.php
	src/Symfony/Component/HttpKernel/HttpCache/Esi.php
	src/Symfony/Component/HttpKernel/Kernel.php
2015-04-01 18:50:12 +02:00
Fabien Potencier
feb48c26b3 bumped Symfony version to 2.3.28 2015-04-01 17:29:10 +02:00
Fabien Potencier
ce4aab1508 updated VERSION for 2.3.27 2015-04-01 16:28:26 +02:00
Fabien Potencier
a7dcf0c15f update CONTRIBUTORS for 2.3.27 2015-04-01 16:28:11 +02:00
Fabien Potencier
dcd7971033 updated CHANGELOG for 2.3.27 2015-04-01 16:27:49 +02:00
Fabien Potencier
3594ea4ec1 security #14167 n/a (nicolas-grekas)
This PR was merged into the 2.3 branch.

Discussion
----------

n/a

Commits
-------

195c57e Safe escaping of fragments for eval()
2015-04-01 16:19:30 +02:00
Fabien Potencier
ad73d3d852 security #14166 n/a (neclimdul)
This PR was merged into the 2.3 branch.

Discussion
----------

n/a

Commits
-------

6c73f0c isFromTrustedProxy to confirm request came from a trusted proxy.
2015-04-01 16:18:06 +02:00
James Gilliland
6c73f0ce93 isFromTrustedProxy to confirm request came from a trusted proxy. 2015-04-01 16:16:10 +02:00
Nicolas Grekas
195c57e1f5 Safe escaping of fragments for eval() 2015-04-01 16:15:02 +02:00
Diego Saint Esteben
17d265a526 Added missing changelog entry 2015-04-01 10:08:53 -03:00
Hugo Hamon
37f7033632 [Form] added missing CHANGELOG notes. 2015-04-01 14:01:31 +02:00
Nicolas Grekas
ac1465e1fb minor #14148 Removed deprecations in VarDumper component (dosten)
This PR was merged into the 3.0-dev branch.

Discussion
----------

Removed deprecations in VarDumper component

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Commits
-------

854300a Removed deprecations in VarDumper component
2015-04-01 13:50:15 +02:00
Nicolas Grekas
5188cfecc5 feature #14080 [VarDumper] Add casters for Reflection* classes (nicolas-grekas)
This PR was merged into the 2.7 branch.

Discussion
----------

[VarDumper] Add casters for Reflection* classes

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | yes
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Will need a rebase on top of #14079 and #14077 to be mergeable/green.

Commits
-------

64d6e76 [VarDumper] Add casters for Reflection* classes
2015-04-01 13:40:31 +02:00
Bernhard Schussek
7523f685eb [TwigBridge] Pushed symfony/form dependency from ~2.6 to ~2.7 2015-04-01 13:22:40 +02:00
Bernhard Schussek
2b5efbbd35 [FrameworkBundle] Pushed symfony/form dependency from ~2.6 to to ~2.7 2015-04-01 13:20:04 +02:00
Bernhard Schussek
776796435e feature #14050 [Form] Refactored choice lists to support dynamic label, value, index and attribute generation (webmozart)
This PR was merged into the 2.7 branch.

Discussion
----------

[Form] Refactored choice lists to support dynamic label, value, index and attribute generation

This is a rebase of #12148 on the 2.7 branch.

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | yes
| Deprecations? | yes
| Tests pass?   | yes
| Fixed tickets | #4067, #5494, #3836, #8658, #12148
| License       | MIT
| Doc PR        | TODO

I implemented the additional options "choice_label", "choice_name", "choice_value", "choice_attr", "group_by" and "choices_as_values" for ChoiceType. Additionally the "preferred_choices" option was updated to accept callables and property paths.

The "choices_as_values" option will be removed in Symfony 3.0, where the choices will be passed in the values of the "choices" option by default. The reason for that is that, right now, choices are limited to strings and integers (i.e. valid array keys). When we flip the array, we remove that limitation. Since choice labels are always strings, we can also always use them as array keys:

```php
// Not possible currently, but possible with "flip_choices"
$builder->add('attending', 'choice', array(
    'choices' => array(
        'Yes' => true,
        'No' => false,
        'Maybe' => null,
    ),
    'choices_as_values' => true,
));
```

All the features described here obviously also apply to subtypes of "choice", such as "entity".

**choice_label**

Returns the label for each choice. Can be a callable (which receives the choice as first and the key of the "choices" array as second argument) or a property path.

If `null`, the keys of the "choices" array are used as labels.

```php
// callable
$builder->add('attending', 'choice', array(
    'choices' => array(
        'yes' => true,
        'no' => false,
        'maybe' => null,
    ),
    'choices_as_values' => true,
    'choice_label' => function ($choice, $key) {
        return 'form.choice.'.$key;
    },
));

// property path
$builder->add('attending', 'choice', array(
    'choices' => array(
        Status::getInstance(Status::YES),
        Status::getInstance(Status::NO),
        Status::getInstance(Status::MAYBE),
    ),
    'choices_as_values' => true,
    'choice_label' => 'displayName',
));
```

**choice_name**

Returns the form name for each choice. That name is used as name of the checkbox/radio form for this choice. It is also used as index of the choice views in the template. Can be a callable (like for "choice_label") or a property path.

The generated names must be valid form names, i.e. contain alpha-numeric symbols, underscores, hyphens and colons only. They must start with an alpha-numeric symbol or an underscore.

If `null`, an incrementing integer is used as name.

```php
// callable
$builder->add('attending', 'choice', array(
    'choices' => array(
        'Yes' => true,
        'No' => false,
        'Maybe' => null,
    ),
    'choices_as_values' => true,
    'choice_name' => function ($choice, $key) {
        // use the labels as names
        return strtolower($key);
    },
));

// property path
$builder->add('attending', 'choice', array(
    'choices' => array(
        'Yes' => Status::getInstance(Status::YES),
        'No' => Status::getInstance(Status::NO),
        'Maybe' => Status::getInstance(Status::MAYBE),
    ),
    'choices_as_values' => true,
    'choice_name' => 'value',
));
```

**choice_value**

Returns the string value for each choice. This value is displayed in the "value" attributes and submitted in the POST/PUT requests. Can be a callable (like for "choice_label") or a property path.

If `null`, an incrementing integer is used as value.

```php
// callable
$builder->add('attending', 'choice', array(
    'choices' => array(
        'Yes' => true,
        'No' => false,
        'Maybe' => null,
    ),
    'choices_as_values' => true,
    'choice_value' => function ($choice, $key) {
        if (null === $choice) {
            return 'null';
        }

        if (true === $choice) {
            return 'true';
        }

        return 'false';
    },
));

// property path
$builder->add('attending', 'choice', array(
    'choices' => array(
        'Yes' => Status::getInstance(Status::YES),
        'No' => Status::getInstance(Status::NO),
        'Maybe' => Status::getInstance(Status::MAYBE),
    ),
    'choices_as_values' => true,
    'choice_value' => 'value',
));
```

**choice_attr**

Returns the additional HTML attributes for choices. Can be an array, a callable (like for "choice_label") or a property path.
If an array, the key of the "choices" array must be used as keys.

```php
// array
$builder->add('attending', 'choice', array(
    'choices' => array(
        'Yes' => true,
        'No' => false,
        'Maybe' => null,
    ),
    'choices_as_values' => true,
    'choice_attr' => array(
        'Maybe' => array('class' => 'greyed-out'),
    ),
));

// callable
$builder->add('attending', 'choice', array(
    'choices' => array(
        'Yes' => true,
        'No' => false,
        'Maybe' => null,
    ),
    'choices_as_values' => true,
    'choice_attr' => function ($choice, $key) {
        if (null === $choice) {
            return array('class' => 'greyed-out');
        }
    },
));

// property path
$builder->add('attending', 'choice', array(
    'choices' => array(
        'Yes' => Status::getInstance(Status::YES),
        'No' => Status::getInstance(Status::NO),
        'Maybe' => Status::getInstance(Status::MAYBE),
    ),
    'choices_as_values' => true,
    'choice_value' => 'htmlAttributes',
));
```

**group_by**

Returns the grouping used for the choices. Can be an array/Traversable, a callable (like for "choice_label") or a property path.

The return values of the callable/property path are used as group labels. If `null` is returned, a choice is not grouped.

If `null`, the structure of the "choices" array is used to construct the groups.

```php
// default
$builder->add('attending', 'choice', array(
    'choices' => array(
        'Decided' => array(
            'Yes' => true,
            'No' => false,
        ),
        'Undecided' => array(
            'Maybe' => null,
        ),
    ),
    'choices_as_values' => true,
));

// callable
$builder->add('attending', 'choice', array(
    'choices' => array(
        'Yes' => true,
        'No' => false,
        'Maybe' => null,
    ),
    'choices_as_values' => true,
    'group_by' => function ($choice, $key) {
        if (null === $choice) {
            return 'Undecided';
        }

        return 'Decided';
    },
));

// property path
$builder->add('attending', 'choice', array(
    'choices' => array(
        'Yes' => Status::getInstance(Status::YES),
        'No' => Status::getInstance(Status::NO),
        'Maybe' => Status::getInstance(Status::MAYBE),
    ),
    'choices_as_values' => true,
    'group_by' => 'type',
));
```

**preferred_choices**

Returns the preferred choices. Can be an array/Traversable, a callable (like for "choice_label") or a property path.

```php
// array
$builder->add('attending', 'choice', array(
    'choices' => array(
        'Yes' => true,
        'No' => false,
        'Maybe' => null,
    ),
    'choices_as_values' => true,
    'preferred_choices' => array(true),
));

// callable
$builder->add('attending', 'choice', array(
    'choices' => array(
        'Yes' => true,
        'No' => false,
        'Maybe' => null,
    ),
    'choices_as_values' => true,
    'preferred_choices' => function ($choice, $key) {
        return true === $choice;
    },
));

// property path
$builder->add('attending', 'choice', array(
    'choices' => array(
        'Yes' => Status::getInstance(Status::YES),
        'No' => Status::getInstance(Status::NO),
        'Maybe' => Status::getInstance(Status::MAYBE),
    ),
    'choices_as_values' => true,
    'preferred_choices' => 'preferred',
));
```

**Technical Changes**

To properly implement all this, the old `ChoiceListInterface` class was deprecated and replaced by a new, slimmer one. The creation of choice views is now separated from choice lists. Hence a lot of logic is not executed anymore when processing (but not displaying) a form.

Internally, a `ChoiceListFactoryInterface` implementation is used to construct choice lists and choice views. Two decorators exist for this class:

* `CachingFactoryDecorator`: caches choice lists/views so that multiple fields displaying the same choices (e.g. in collection fields) use the same choice list/view
* `PropertyAccessDecorator`: adds support for property paths to a factory

**BC Breaks**

The option "choice_list" of ChoiceType now contains a `Symfony\Component\Form\ChoiceList\ChoiceListInterface` instance, which is a super-type of the deprecated `ChoiceListInterface`.

**Todos**

- [ ] Adapt CHANGELOGs
- [ ] Adapt UPGRADE files
- [ ] symfony/symfony-docs issue/PR

Commits
-------

94d18e9 [Form] Fixed CS
7e0960d [Form] Fixed failing layout tests
1d89922 [Form] Fixed tests using legacy functionality
d6179c8 [Form] Fixed PR comments
26eba76 [Form] Fixed regression: Choices are compared by their values if a value callback is given
a289deb [Form] Fixed new ArrayChoiceList to compare choices by their values, if enabled
e6739bf [DoctrineBridge] DoctrineType now respects the "query_builder" option when caching the choice loader
3846b37 [DoctrineBridge] Fixed: don't cache choice lists if query builders are constructed dynamically
03efce1 [Form] Refactored choice lists to support dynamic label, value, index and attribute generation
2015-04-01 12:04:55 +02:00
Bernhard Schussek
94d18e961c [Form] Fixed CS 2015-04-01 11:48:14 +02:00
Bernhard Schussek
7e0960d716 [Form] Fixed failing layout tests 2015-04-01 11:48:14 +02:00
Bernhard Schussek
1d89922782 [Form] Fixed tests using legacy functionality 2015-04-01 11:48:11 +02:00
Bernhard Schussek
d6179c830b [Form] Fixed PR comments 2015-04-01 11:47:34 +02:00
stloyd
4c57e775f0 Remove deprecated Locale component 2015-04-01 10:32:55 +02:00
Nicolas Grekas
ccf58cd1a8 Merge branch '2.7'
* 2.7:
  [travis] Fix tests cancellations
  [VarDumper] Make use of Caster::PREFIX_* consts
  [VarDumper] Optimized some code
2015-04-01 09:24:22 +02:00
Nicolas Grekas
ef886548a0 Merge branch '2.6' into 2.7
* 2.6:
  [travis] Fix tests cancellations
2015-04-01 09:24:08 +02:00
Nicolas Grekas
48bd5500d0 Merge branch '2.3' into 2.6
* 2.3:
  [travis] Fix tests cancellations
2015-04-01 09:23:56 +02:00
Nicolas Grekas
85c97815f3 minor #14141 [travis] Revert tests cancellations and don't fail if memcached is not avail (nicolas-grekas)
This PR was merged into the 2.3 branch.

Discussion
----------

[travis] Revert tests cancellations and don't fail if memcached is not avail

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

I don't understand how travis gets its $TRAVIS_COMMIT, but this should make things stable again.

Commits
-------

7441955 [travis] Fix tests cancellations
2015-04-01 09:23:35 +02:00
Nicolas Grekas
7441955a50 [travis] Fix tests cancellations 2015-04-01 08:29:01 +02:00
Diego Saint Esteben
854300a73e Removed deprecations in VarDumper component 2015-03-31 19:47:40 -03:00
Nicolas Grekas
64d6e76e42 [VarDumper] Add casters for Reflection* classes 2015-03-31 21:51:54 +02:00
Nicolas Grekas
b1e2dedf9e feature #14079 [VarDumper] Add and use Caster::PREFIX_* consts (nicolas-grekas)
This PR was merged into the 2.7 branch.

Discussion
----------

[VarDumper] Add and use Caster::PREFIX_* consts

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Will need a rebase on top of #14058 once it is merged

Commits
-------

86cf8de [VarDumper] Make use of Caster::PREFIX_* consts
2015-03-31 17:03:27 +02:00
Nicolas Grekas
86cf8dee5e [VarDumper] Make use of Caster::PREFIX_* consts 2015-03-31 16:41:17 +02:00
Nicolas Grekas
7e2d3747da minor #14135 [TwigBridge] Remove legacy test (nicolas-grekas)
This PR was merged into the 3.0-dev branch.

Discussion
----------

[TwigBridge] Remove legacy test

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Commits
-------

4af7c89 [TwigBridge] Remove legacy test
2015-03-31 16:21:18 +02:00
Nicolas Grekas
c5dce60c88 minor #14137 [VarDumper] Optimized some code (lyrixx)
This PR was merged into the 2.7 branch.

Discussion
----------

[VarDumper] Optimized some code

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | ✘
| License       | MIT
| Doc PR        | ✘

asked by @nicolas-grekas

Commits
-------

e8d2983 [VarDumper] Optimized some code
2015-03-31 16:19:58 +02:00
Grégoire Pineau
e8d2983d9e [VarDumper] Optimized some code 2015-03-31 15:54:17 +02:00
Abdellatif Ait boudad
2669016f1b feature #14120 Removed deprecation in translation component (saro0h)
This PR was merged into the 3.0-dev branch.

Discussion
----------

Removed deprecation in translation component

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | ~
| License       | MIT
| Doc PR        | ~

Commits
-------

2220b90 Removed deprecation in translation component
2015-03-31 14:21:18 +01:00
stloyd
13ec9ffafc Remove dead code from FrameworkExtension & LogoutUrlHelper 2015-03-31 15:19:41 +02:00
Nicolas Grekas
4af7c89711 [TwigBridge] Remove legacy test 2015-03-31 15:13:13 +02:00