Commit Graph

10668 Commits

Author SHA1 Message Date
Fabien Potencier 019625d34e merged branch bschussek/options_performance (PR #5004)
Commits
-------

24b764e [Form] Fixed issues mentioned in the PR
9216816 [Form] Turned Twig filters into tests
310f985 [Form] Added a layer of 2.0 BC methods to FormView and updated UPGRADE and CHANGELOG
5984b18 [Form] Precalculated the closure for deciding whether a choice is selected (PHP +30ms, Twig +30ms)
5dc3c39 [Form] Moved the access to templating helpers out of the choice loop for performance reasons (PHP +100ms)
0ef9acb [Form] Moved the method isChoiceSelected() to the ChoiceView class (PHP +150ms)
8b72766 [Form] Tweaked the generation of option tags for performance (PHP +200ms, Twig +50ms)
400c95b [Form] Replace methods in ChoiceView by public properties (PHP +100ms, Twig +400ms)
d072f35 [Form] The properties of FormView are now accessed directly in order to increase performance (PHP +200ms, Twig +150ms)

Discussion
----------

[Form] Made FormView and ChoiceView properties public for performance reasons

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

This PR changes the access to properties of `FormView` and `ChoiceView` objects from getters to direct property accesses. On [my example form](http://advancedform.gpserver.dk/app_dev.php/taxclasses/1) this improves rendering performance for **300ms** with PHP templates and **550ms** with Twig on my local machine.

Unfortunately, this breaks BC both with 2.0 and with the current master in Form Types and PHP templates. Twig templates are not affected by this change.

2.0:
```
$formView->set('my_var', 'foobar');
$formView->get('my_var');
$formView->getChild('childName');
$formView['childName'];
```

master:
```
$formView->setVar('my_var', 'foobar');
$formView->getVar('my_var');
$formView->get('childName');
$formView['childName'];
```

this PR:
```
$formView->vars['my_var'] = 'foobar';
$formView->vars['my_var'];
$formView->children['childName'];
$formView['childName'];
```

Should we add methods to keep BC with 2.0?

The second part of this PR contains improvements to the rendering of choice fields. These gain another **~500ms** for PHP templates and **80ms** for Twig. These improvements are BC, unless you overwrote the block "choice_widget_options" in your form themes which then needs to be adapted.

**Update:**

The PR now includes a BC layer for 2.0.

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

by stof at 2012-07-21T11:37:41Z

@bschussek couldn't we keep the getters and setters for BC even if the rendering accesses the public properties directly ?

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

by bschussek at 2012-07-21T11:52:33Z

@stof A BC layer for 2.0 is now included. People who upgraded to master already unfortunately need to adapt their code.

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

by sstok at 2012-07-21T12:40:57Z

👍
2012-07-21 19:51:42 +02:00
Bernhard Schussek 24b764e066 [Form] Fixed issues mentioned in the PR 2012-07-21 19:45:31 +02:00
Bernhard Schussek 921681658c [Form] Turned Twig filters into tests 2012-07-21 17:26:50 +02:00
Bernhard Schussek 310f985b99 [Form] Added a layer of 2.0 BC methods to FormView and updated UPGRADE and CHANGELOG 2012-07-21 13:49:32 +02:00
Fabien Potencier 6c256b01b0 merged branch KaipiYann/Fix-DocBlock-attemptAuthentication (PR #4996)
Commits
-------

134cc84 [Security] Fix DocBlock of attemptAuthentication

Discussion
----------

[Security] Fix DocBlock of attemptAuthentication

Bug fix: no
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets:
Todo: -
License of the code: MIT
Documentation PR: -
2012-07-21 13:16:18 +02:00
Fabien Potencier 70477b7c95 merged branch Slamdunk/hotfix/late-static-create (PR #4991)
Commits
-------

9dc2011 Late static factory method

Discussion
----------

Late static factory method

When using `Symfony\CS\Finder\DefaultFinder::create()`, we lose all `Symfony\CS\Finder\DefaultFinder::__construct()` properties because main `Finder` does not use late static binding.

This commit resolves the issue.
2012-07-21 13:14:55 +02:00
Fabien Potencier deb98d9163 merged branch bschussek/setdata_performance (PR #5003)
Commits
-------

d4f4038 [Form] Reduced the number of setData() calls by deferring a Form's initialization (+40ms)

Discussion
----------

[Form] Reduced the number of setData() calls

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

This PR decreases the number of expensive `setData()` calls on `Form` instances by deferring the form's initialization with default data to the first call to a `get*Data()` method. If `setData()` is called manually before invoking `get*Data()`, the initialization with the default data will not take place.

Before:

```
$form = new Form($config); // implicit setData($config->getData());
$form->setData($object); // setData() is now called twice
```

After:

```
$form = new Form($config); // no implicit setData()
$form->getData(); // implicit setData($config->getData())

// or

$form = new Form($config);
$form->setData($object);
$form->getData(); // setData() was called only once
```
2012-07-21 13:12:45 +02:00
Fabien Potencier 638058ad84 merged branch bschussek/filtertonormalizer (PR #5002)
Commits
-------

3075fa6 [OptionsResolver] Renamed filters to normalizers

Discussion
----------

[OptionsResolver] Renamed filters to normalizers

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

This PR fixes the naming to be in line with the Serializer component.
2012-07-21 13:09:22 +02:00
Bernhard Schussek 3075fa6b39 [OptionsResolver] Renamed filters to normalizers 2012-07-21 13:02:12 +02:00
Bernhard Schussek d4f4038f6d [Form] Reduced the number of setData() calls by deferring a Form's initialization (+40ms) 2012-07-21 12:57:35 +02:00
Bernhard Schussek 5984b18a7a [Form] Precalculated the closure for deciding whether a choice is selected (PHP +30ms, Twig +30ms) 2012-07-21 12:56:50 +02:00
Bernhard Schussek 5dc3c39fd2 [Form] Moved the access to templating helpers out of the choice loop for performance reasons (PHP +100ms) 2012-07-21 12:56:50 +02:00
Bernhard Schussek 0ef9acb479 [Form] Moved the method isChoiceSelected() to the ChoiceView class (PHP +150ms) 2012-07-21 12:56:50 +02:00
Bernhard Schussek 8b72766473 [Form] Tweaked the generation of option tags for performance (PHP +200ms, Twig +50ms) 2012-07-21 12:56:50 +02:00
Bernhard Schussek 400c95bb4d [Form] Replace methods in ChoiceView by public properties (PHP +100ms, Twig +400ms) 2012-07-21 12:56:11 +02:00
Bernhard Schussek d072f35ea0 [Form] The properties of FormView are now accessed directly in order to increase performance (PHP +200ms, Twig +150ms) 2012-07-21 12:56:11 +02:00
Kaipi Yann 134cc84e99 [Security] Fix DocBlock of attemptAuthentication
Add Response as possible return type of the method because the method AbstractAuthenticationListener::handle() test if $returnValue is an instance of Response (line 148).
2012-07-20 15:46:05 +02:00
Filippo Tessarotto 9dc20116e3 Late static factory method 2012-07-20 11:54:42 +02:00
Fabien Potencier 9f157a1616 merged branch docteurklein/unique-entity-validator-with-custom-repository-method (PR #4979)
Commits
-------

4eb54a0 update CHANGELOG
db9ea09 [Doctrine] [Bridge] fix repositoryMethod test
2a6c222 Add a customRepository option to the uniqueEntity validator

Discussion
----------

[Doctrine] [Bridge] Add a "repositoryMethod" option to the uniqueEntity validator

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: ~

This allows to configure the repository method used to verify uniqueness of entity.
Before, it was always using `findBy`.

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

by fabpot at 2012-07-20T05:35:28Z

Can you add a note in the CHANGELOG?

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

by docteurklein at 2012-07-20T07:17:08Z

@fabpot done.
2012-07-20 11:35:08 +02:00
Klein Florian 4eb54a042d update CHANGELOG 2012-07-20 09:25:13 +02:00
Fabien Potencier 4bde2aac41 merged 2.0 2012-07-20 07:34:13 +02:00
Fabien Potencier 112a51392a merged branch vicb/response/statuscode (PR #4980)
Commits
-------

ed8823c [HttpFoundation] Allow setting an unknown status code without specifying a text

Discussion
----------

[HttpFoundation] Allow setting an unknown status code without specifying...

... a text

fix #4978
2012-07-20 07:30:32 +02:00
Fabien Potencier c0fc40013a merged branch eko/2.0 (PR #4983)
Commits
-------

16a980b [Validator] Fix bug order for constraint, property, getter and group-sequence-provider in validation.xml

Discussion
----------

[Validator] Fix bug order for constraint, property, getter and group-seq...

Actually, there is a bug that force developers to write validation.xml file with the following nodes order:

- constraint
- property
- getter

So that's not possible to have the following XML (because I need to write my property(ies) first).

```xml
<?xml version="1.0" encoding="UTF-8" ?>
<constraint-mapping xmlns="http://symfony.com/schema/dic/constraint-mapping"
                    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                    xsi:schemaLocation="http://symfony.com/schema/dic/constraint-mapping http://symfony.com/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd">

    <class name="Application\Eko\MyBundle\Entity\MyEntity">
        <getter property="isBar">
            <constraint name="True">
                <option name="message">My error message</option>
            </constraint>
        </getter>

        <property name="foo">
            <constraint name="NotBlank" />
        </property>
    </class>

</constraint-mapping>
```

The XML below result in the following exception:

```
[ERROR 1871] Element '{http://symfony.com/schema/dic/constraint-mapping}property': This element is not expected. Expected is ( {http://symfony.com/schema/dic/constraint-mapping}getter ). (in /var/www/myproject/src/Application/Eko/MyBundle/Resources/config/validation.xml - line 14, column 0)
```

This is due to the sequence element that needs to respect the order given in the schema file.

The choice element is doing the same thing and permit to have a free order of elements so I have replaced the sequence by a choice element.

For more information: http://www.w3.org/TR/xmlschema-0/#ref17
2012-07-20 07:29:27 +02:00
Fabien Potencier 7d2f814a03 Merge branch '2.0'
* 2.0:
  [Console] Use proc_open instead of exec to suppress errors when run on windows and stty is not present
2012-07-20 07:27:52 +02:00
Jordi Boggiano 4f93d1addd [Console] Use proc_open instead of exec to suppress errors when run on windows and stty is not present 2012-07-20 07:25:32 +02:00
Fabien Potencier 503899e26c merged branch Seldaek/rename (PR #4986)
Commits
-------

c81b2ad [Form] Rename UnmodifiableFormConfig to ImmutableFormConfig
274eb9e [EventDispatcher] Rename UnmodifiableEventDispatcher to ImmutableEventDispatcher

Discussion
----------

Rename unmodifiable to immutable

Maybe it's just me, but it sounded really wrong. The EventDispatcher one was added in 2.1 so no BC break. I don't know about the Form one, but I guess it's just used internally anyway.
2012-07-20 07:16:03 +02:00
Fabien Potencier b201812927 merged branch Fran6co/fix-security-handlers (PR #4985)
Commits
-------

39157a8 [Security] fixes multiple overlapping definitions of DefaultFailureHandler and DefaultSuccessHandler in AbstractFactory

Discussion
----------

[Security] fixes multiple overlapping definitions of DefaultFailureHandler and DefaultSuccessHandler in AbstractFactory

If more than one listener extends AbstractFactory, you'll have multiple calls to createAuthenticationFailureHandler and createAuthenticationSuccessHandler with the same id.

Implicitly it's going to use the one generated by the last factory generating unexpected behavior.

This is related to commits 915704c071 and c6aa392df7
2012-07-20 07:15:13 +02:00
Fabien Potencier a7c0b7f6e1 merged branch Tobion/patch-3 (PR #4984)
Commits
-------

d85650d [Validator] remove return value in TrueValidator

Discussion
----------

[Validator] remove return value in TrueValidator
2012-07-20 07:12:22 +02:00
Jordi Boggiano c81b2ad3e2 [Form] Rename UnmodifiableFormConfig to ImmutableFormConfig 2012-07-20 01:18:42 +02:00
Jordi Boggiano 274eb9ebaf [EventDispatcher] Rename UnmodifiableEventDispatcher to ImmutableEventDispatcher 2012-07-20 01:18:14 +02:00
Francisco Facioni 39157a852d [Security] fixes multiple overlapping definitions of DefaultFailureHandler and DefaultSuccessHandler in AbstractFactory 2012-07-19 19:25:03 -03:00
Tobias Schultze d85650d29f [Validator] remove return value in TrueValidator 2012-07-19 23:47:59 +03:00
Vincent Composieux 16a980b937 [Validator] Fix bug order for constraint, property, getter and group-sequence-provider in validation.xml 2012-07-19 20:43:09 +02:00
Victor Berchet ed8823c168 [HttpFoundation] Allow setting an unknown status code without specifying a text 2012-07-19 17:48:12 +02:00
Klein Florian db9ea095f0 [Doctrine] [Bridge] fix repositoryMethod test 2012-07-19 16:54:35 +02:00
Fabien Potencier 67bf84d7c5 [Routing] fixed typo 2012-07-19 16:39:03 +02:00
Klein Florian 2a6c222c51 Add a customRepository option to the uniqueEntity validator 2012-07-19 16:24:10 +02:00
Fabien Potencier 42f1f12ec5 merged branch mpiecko/patch-1 (PR #4977)
Commits
-------

f5e03a3 Changed $request->setDefaultLocale() to $request->setLocale() in custom LocaleListener.

Discussion
----------

Changed $request->setDefaultLocale() to $request->setLocale() in custom ...

...LocaleListener.

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

by mpiecko at 2012-07-19T13:05:07Z

This is based on my comments from https://github.com/symfony/symfony/pull/4692#issuecomment-7096255
2012-07-19 15:10:58 +02:00
Michael Piecko f5e03a3716 Changed $request->setDefaultLocale() to $request->setLocale() in custom LocaleListener. 2012-07-19 15:48:21 +03:00
Fabien Potencier 382f8a5eb9 merged branch Tobion/patch-2 (PR #4968)
Commits
-------

1986e10 [HttpFoundation] optimize makeDisposition

Discussion
----------

[HttpFoundation] optimize makeDisposition
2012-07-19 11:21:09 +02:00
Fabien Potencier d5463acb23 merged branch cs278/rhel5-invalid-exitcode (PR #4970)
Commits
-------

310c458 [Process] Fixed a problem on RHEL5 where the exit code was incorrect

Discussion
----------

[Process] Fixed a problem on RHEL5 where the exit code was incorrect

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

RHEL5 will intermittently result in an exit code of -1 due to `proc_get_status()` being called after the process has completed but outside of `updateStatus()` which saves the exit code.

See composer/composer#876
2012-07-19 10:06:46 +02:00
Fabien Potencier f53c4ba1e5 merged branch pborreli/profiler-pixel (PR #4969)
Commits
-------

3bb975c [WebProfilerBundle] Fixed white pixel in toolbar info

Discussion
----------

[WebProfilerBundle] Fixed white pixel in toolbar info

Fixed this ![white pixel](http://www7.pic-upload.de/18.07.12/l7ve9xrevwc.png)

Tested on IE9/FF/Chrome
2012-07-18 19:56:21 +02:00
Chris Smith 310c458936 [Process] Fixed a problem on RHEL5 where the exit code was incorrect
RHEL5 will intermittently result in an exit code of -1 [1] due to
proc_get_status() being called after the process has completed
but outside of updateStatus() which saves the exit code.

[1]: https://github.com/composer/composer/issues/876
2012-07-18 18:33:32 +01:00
Pascal Borreli 3bb975c153 [WebProfilerBundle] Fixed white pixel in toolbar info 2012-07-18 19:29:43 +02:00
Tobias Schultze 1986e1052a [HttpFoundation] optimize makeDisposition 2012-07-18 18:28:33 +03:00
Fabien Potencier cb82287416 merged branch weaverryan/upgrade-listener-priorities (PR #4928)
Commits
-------

96638f4 [UPGRADE] Tweaking formatting error with event listener section. Also tweaking values

Discussion
----------

[UPGRADE] Tweaking formatting error with event listener section and information

Hey guys!

This is just a documentation change based on sha: 5da1bc6a4f

Check out the details in the commit message - I'm not sure if this is right, but the original commit seemed a bit odd compared to what I was seeing in the code. There was also a fix to the formatting.

If I've missed something, I'm happy to change the commit as needed.

Thanks!

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

by stof at 2012-07-14T21:53:12Z

There is no equivalent to early_kernel_request for the router listener as both methods have been merged together (it was separated so that the initialization of the RequestContext was done before the firewall, but the whole logic is before the firewall now)
2012-07-18 17:00:08 +02:00
Fabien Potencier ec5fee0cbb merged branch biozshock/more-verbose-message-form-getname (PR #4940)
Commits
-------

89975ef Added more verbose message for exception when form types have wrong getName method

Discussion
----------

Added more verbose message for exception when form types have wrong getName

PR based on discussion of commit introduces exception when custom form type have no getName method. 6489a65960

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

by biozshock at 2012-07-17T08:15:35Z

@tyx thanks. Fixed. ;)

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

by fabpot at 2012-07-17T20:46:57Z

Can you squash your commits before I merge? Thanks.

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

by noetix at 2012-07-17T23:49:51Z

I think the variables should have quotes around them. It seems like all other error messages have them.

From: The type name specified for the service form.type.translatable does not match the actual name. Expected translatable_field, given translator

To: The type name specified for the service "form.type.translatable" does not match the actual name. Expected "translatable_field", given "translator"

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

by biozshock at 2012-07-18T09:39:01Z

@fabpot Done.
@noetix Thanks for remark.
2012-07-18 14:45:41 +02:00
Artem Lopata (bumz) 89975ef9d6 Added more verbose message for exception when form types have wrong getName method 2012-07-18 12:37:22 +03:00
Fabien Potencier 4ce724936a moved the request data collector to HttpKernel 2012-07-18 10:39:53 +02:00
Fabien Potencier a7503fb399 added a missing comment 2012-07-18 10:24:35 +02:00