Commit Graph

9390 Commits

Author SHA1 Message Date
lsmith77
d4a78a21de fix phpdoc statement of getAlias() 2012-08-03 10:28:07 +02:00
Victor Berchet
6097c804ce [DoctrineBridge] Fix log of non utf8 data 2012-08-03 10:23:47 +02:00
Fabien Potencier
13c60bdeaf merged branch henrikbjorn/2.0 (PR #5137)
Commits
-------

0b78fdf Only call registerCommand on bundles that is an instance of Bundle

Discussion
----------

Only call registerCommand on bundles that is an instance of Bundle

Fixes GH-5133

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

by travisbot at 2012-08-01T09:41:05Z

This pull request [fails](http://travis-ci.org/symfony/symfony/builds/2008252) (merged 0b78fdff into 1da896dc).

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

by henrikbjorn at 2012-08-01T10:05:00Z

Build failed because of HTTP request error.

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

by lsmith77 at 2012-08-01T11:31:08Z

wondering if it would be good if you could include the commit from #5133 in this PR .. then we get the test and the fix at once.
2012-08-03 10:19:10 +02:00
Victor Berchet
a0709fc365 [DoctrineBridge] Fix log of non utf8 data 2012-08-01 13:10:42 +02:00
Henrik Bjørnskov
0b78fdffa4 Only call registerCommand on bundles that is an instance of Bundle
Fixes GH-5133
2012-08-01 11:35:03 +02:00
Josiah Truasheim
30bcb57286 Added a test case to demonstrate the fatal error occuring when a Bundle implementing BundleInterface only is registered in the kernel. 2012-08-01 09:25:05 +07:00
Evan Kaufman
c6a9638adb OptionsResolver#validateOptionTypes should check if option value exists before checking its type; added corresponding test
OptionsResolver#validateOptionsCompleteness would already have thrown exception if the option were required, so this should only affect something explicitly marked as optional
2012-07-31 20:34:40 -05:00
Fabien Potencier
b1618d210c merged branch vicb/doctrine_deps (PR #5127)
Commits
-------

4ae54e3 [Composer] Bumped doctrine/orm to 2.2.3

Discussion
----------

[Composer] Bumped doctrine/orm to 2.2.3

fix #4966

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

by stloyd at 2012-07-31T15:01:41Z

You should also _bump_ Security component [deps](https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Security/composer.json#L28).

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

by vicb at 2012-07-31T15:05:03Z

The security does not depend on `doctrine/orm`
2012-07-31 17:06:32 +02:00
Victor Berchet
4ae54e39fc [Composer] Bumped doctrine/orm to 2.2.3 2012-07-31 16:51:24 +02:00
Fabien Potencier
ee2b8c474e merged branch bschussek/bootstrap (PR #5112)
Commits
-------

b982883 [Form] Moved FormHelper back to FrameworkBundle
cb62d05 [Form] [Validator] Fixed issues mentioned in the PR
2185ca8 [Validator] Added entry point "Validation" for more convenient usage outside of Symfony2
ed87361 [Form] Moved FormHelper creation to TemplatingExtension
87ccb6a [Form] Added entry point "Forms" for more convenient usage outside of Symfony

Discussion
----------

[Form] [Validator] Added more convenient entry points for stand-alone usage

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

This PR greatly simplifies the usage of the Form and Validator component when used outside of Symfony2. Check out the below code to get an idea about the simplified usage:

```php
<?php

use Symfony\Component\Validator\Validation;
use Symfony\Component\Validator\Mapping\Cache\ApcCache;
use Symfony\Component\Form\Forms;
use Symfony\Component\Form\Extension\HttpFoundation\HttpFoundationExtension;
use Symfony\Component\Form\Extension\Csrf\CsrfExtension;
use Symfony\Component\Form\Extension\Csrf\CsrfProvider\SessionCsrfProvider;
use Symfony\Component\Form\Extension\Templating\TemplatingExtension;
use Symfony\Component\Form\Extension\Validator\ValidatorExtension;
use Symfony\Component\HttpFoundation\Session;
use Symfony\Component\Templating\PhpEngine;

$session = new Session();
$secret = 'V8a5Z97e...';
$csrfProvider = new SessionCsrfProvider($session, $secret);
$engine = new PhpEngine(/* ... snap ... */);

$validator = Validation::createValidator();
// or
$validator = Validation::createValidatorBuilder()
    ->addXmlMapping('path/to/mapping.xml')
    ->addYamlMapping('path/to/mapping.yml')
    ->addMethodMapping('loadValidatorMetadata')
    ->enableAnnotationMapping()
    ->setMetadataCache(new ApcCache())
    ->getValidator();

$formFactory = Forms::createFormFactory();
// or
$formFactory = Forms::createFormFactoryBuilder()
    // custom types, if you're too lazy to create an extension :)
    ->addType(new PersonType())
    ->addType(new PhoneNumberType())
    ->addTypeExtension(new FormTypeHelpTextExtension())
    // desired extensions (CoreExtension is loaded by default)
    ->addExtension(new HttpFoundationExtension())
    ->addExtension(new CsrfExtension($csrfProvider))
    ->addExtension(new TemplatingExtension($engine, $csrfProvider, array(
        'FormBundle:Form'
    ))
    ->addExtension(new ValidatorExtension($validator))
    ->getFormFactory();

$form = $formFactory->createBuilder()
    ->add('firstName', 'text')
    ->add('lastName', 'text')
    ->add('age', 'integer')
    ->add('gender', 'choice', array(
        'choices' => array('m' => 'Male', 'f' => 'Female'),
    ))
    ->getForm();

if (isset($_POST[$form->getName()])) {
    $form->bind($_POST[$form->getName()]);

    if ($form->isValid()) {
        // do stuff
    }
}

return $engine->render('AcmeHelloBundle:Hello:index.html.php', array(
    'form' => $form->createView(),
));
```

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

by bschussek at 2012-07-30T10:08:42Z

I should maybe add a comment about the benefits of this change, in case they are not self-explanatory:

* class construction with default configuration is now a one-liner
* userland code is decoupled from core implementations → userland code doesn't break if we change constructor signatures
* easier to understand, since many core classes are now created internally
* easy to discover the possible settings → just look at (FormFactory|Validator)BuilderInterface
* usage of custom interface implementations is supported, just like before

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

by fabpot at 2012-07-31T08:18:53Z

The new syntax is great.

I have one comment though about this PR about support of PHP as a templating system (support for Twig is provided by the bridge and it was already easy to configure Twig as a templating system for forms -- see Silex for instance).

The `FormHelper` has been moved into the Form component. This helper is only useful when using the PHP templating system (which is not what we recommend people to use), but the default templates are still in the Framework bundle. So using the Form component as standalone with PHP as a templating system still requires to install the bundle to get access to the default templates. Am I missing something? Do we want to move the PHP templates to the Form component too?

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

by stof at 2012-07-31T08:28:28Z

@fabpot it is even worse than that: the FormHelper currently uses the theme by using ``$theme . ':' . $block . '.html.php`` IIRC. This is not compatible with the default template name parser of the component expecting a path. And the FrameworkBundle template name parser does not support accessing a template outside a bundle AFAIK.
So moving the templating to the component would require some refactoring in the FormHelper and the template name parser. However, I think it is worth it. Some people complained that using the form rendering (outside the full-stack framework) was requiring either setting up Twig with the bridge, or adding FrameworkBundle in the project (which means including most of the code of the full-stack framework). Having the Templating rendering in the standalone component could be a great idea

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

by fabpot at 2012-07-31T08:42:53Z

But then, I don't want to promote the Templating component or the PHP templating system. Twig is always a better alternative and this should be what people use most of the time, PHP being the rare exception.

Anyway, we are too close from the first 2.1 RC, so any big refactoring will have to wait for 2.2.

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

by stof at 2012-07-31T09:02:10Z

then maybe we should keep the FormHelper in FrameworkBundle for now as it is tied to the FrameworkBundle template name parser anyway currently.

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

by bschussek at 2012-07-31T14:22:35Z

> it it is even worse than that: the FormHelper currently uses the theme by using ``$theme . ':' . $block . '.html.php`` IIRC. This is not compatible with the default template name parser of the component expecting a path.

This is why the templates are still in FrameworkBundle. I think they should be moved too, but then we have to change

* the default theme to an absolute file path
* the FrameworkBundle name parser to accept absolute paths

I think this can wait until 2.2. Baby steps.

> I don't want to promote the Templating component or the PHP templating system.

We can both promote Twig while making Templating as easy to use as possible. If people want to use Templating, they probably have a reason. We don't have to make their lives more painful than necessary.

Btw: Templating is a *lot* faster for rendering forms than Twig. On Denis' form, Templating takes 1.15 seconds while Twig takes 2.

About moving the helpers, we have two choices:

* Move each helper to the respective component. This would not require new releases of the Templating component when we add more helpers in other component.

* Move all helpers to Templating. This does not make that much sense for Form, as then Form has support for Templating (TemplatingRendererEngine) and Templating has support for Form (FormHelper), which is a bit weird. I personally prefer a stacked architecture, where Templating is at the bottom and Form-agnostic, and Form (or any other component) builds upon that.

I'm fine with both approaches. I'll move FormHelper back to FrameworkBundle, and we can decide for a direction in 2.2.

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

by bschussek at 2012-07-31T14:36:30Z

Done.
2012-07-31 16:38:15 +02:00
Bernhard Schussek
b982883a85 [Form] Moved FormHelper back to FrameworkBundle 2012-07-31 16:35:46 +02:00
Fabien Potencier
4b521985f1 merged branch vicb/lenient_generator (PR #5114)
Commits
-------

03bbaaf [Routing] Add an interface for configuring strict_parameters

Discussion
----------

[RFC][Routing] Add an interface for configuring strict_parameters

This is a proposal to fix #4697 (related to #4592).

The main point left to discuss was the name of the interface, which is now `LenientInterface`. We could change the name to anything else is someone has a better idea.

@stof @Tobion what do you think ?

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

by stof at 2012-07-30T16:34:20Z

@vicb I already said I had no idea to name it, and it has not changed. :)
So let's wait for other people to see if they have a better idea

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

by breerly at 2012-07-30T16:38:38Z

Maybe `PermissibleInterface` or `PermissiveInterface`.

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

by Partugal at 2012-07-30T17:00:09Z

`StrictUrlGeneratorInterface`, `StrictParametersInterface` or `StrictInterface`

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

by pborreli at 2012-07-30T17:04:46Z

👍 for `PermissiveInterface`

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

by stof at 2012-07-30T17:07:59Z

yes, because the Router currently can only use this interface to set it to ``not-strict``. It assumes that the url generator is already strict by default (which is probably a bad assumption btw as the base class for the generated generator can be changed)

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

by pborreli at 2012-07-30T17:09:33Z

@stof thx, got it

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

by Partugal at 2012-07-30T17:10:03Z

this interface realize setting Strict by setStrictParameters, and get by getStrictParameters, and imho named it by `Strictable` is more logic

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

by pborreli at 2012-07-30T17:11:07Z

@Partugal let's try to find an english term :)

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

by Partugal at 2012-07-30T17:11:31Z

)

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

by breerly at 2012-07-30T17:15:23Z

@Partugal I like using "able" in interface names because it describes a behavior instead of a noun. This type of naming makes following the Interface Segregation Principle easy to follow. Good work.

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

by vicb at 2012-07-30T18:24:26Z

As explained by @stof I did not consider `StrictInterface` because as of now the interface is used to disabled the strict bevahior (which is enabled by default).

I am not satisfied with `PermissiveInterface` / `LenientInterface` because implementing this interface does not mean that the generator will be permissive but only that the behavior is configurable - yes I did consider `Configurable` but the term is a too vague.

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

by breerly at 2012-07-30T18:35:45Z

I see. Perhaps ```StrictConfigurableInterface``` would do the trick.

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

by Tobion at 2012-07-30T21:02:21Z

I think renaming strict_parameters to `strict_requirements` is the way to go because it determines how requirements are handled when generating a URL. Also we should allow another option:
strict_requirements = true: throw exception for mismatching requirements
strict_requirements = null: return null as URL for mismatching requirements and log it.
strict_requirements = false: return the URL with the given parameters without checking the requirements and don't log it.
(Maybe use constants for these).
The Interface I would then call `ConfigurableRequirementsInterface` or `RequirementsHandlingInterface`.

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

by vicb at 2012-07-31T07:23:24Z

Thanks all for the feeback, this is what is now implemented:

- A `ConfigurableRequirementsInterface` that should be implemented by generators that can be configure not to throw an exception when the parameters do not match the requirements,
- The interface has two methods: `setStrictRequirements()` and `isStrictRequirements()`,
- `setStrictRequirements()` always gets called to configure the generator (whatever the option value is)

Note: The Router option name has not changed (i.e. `strict_parameters`)

Does that fit everyone ?

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

by vicb at 2012-07-31T07:39:22Z

So the option name is now consistent (`strict_requirements`) with the interface. We should sync the change [in the standard edition](https://github.com/symfony/symfony-standard/blob/master/app/config/config.yml#L11) if we agree to merge this.

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

by fabpot at 2012-07-31T07:51:47Z

@vicb you forgot to rename the property in `UrlGenerator` as @stof mentioned above.

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

by vicb at 2012-07-31T07:59:57Z

@fabpot fixed. If the code is ok, I'll squash the commits and open a PR on symfony-standard
2012-07-31 16:16:14 +02:00
Victor Berchet
03bbaaf325 [Routing] Add an interface for configuring strict_parameters 2012-07-31 16:14:37 +02:00
lsmith77
cdfbe72be4 handle inheritance in config:dump-reference when a bundle name is passed to the command 2012-07-31 15:20:04 +02:00
Bilal Amarni
f84f5fd6b5 fixed typo 2012-07-31 16:07:47 +03:00
Fabien Potencier
788e5eb730 [HttpKernel] added a way to override the default response status code when handling an exception (closes #5043) 2012-07-31 10:32:57 +02:00
Bernhard Schussek
cb62d05f8d [Form] [Validator] Fixed issues mentioned in the PR 2012-07-30 16:22:02 +02:00
Bernhard Schussek
2185ca80e2 [Validator] Added entry point "Validation" for more convenient usage outside of Symfony2 2012-07-30 11:41:40 +02:00
Bernhard Schussek
ed8736140f [Form] Moved FormHelper creation to TemplatingExtension 2012-07-30 11:41:40 +02:00
Bernhard Schussek
87ccb6adb9 [Form] Added entry point "Forms" for more convenient usage outside of Symfony 2012-07-30 11:41:38 +02:00
Fabien Potencier
a172a81296 merged branch pborreli/browserkit (PR #5097)
Commits
-------

910b60d [BrowserKit] Added some tests, removed dead code

Discussion
----------

[BrowserKit] Added some tests

Code coverage : 99.68%
2012-07-30 11:17:59 +02:00
Fabien Potencier
cbd03ec4c6 merged branch vicb/resolver_options (PR #5110)
Commits
-------

a47922b [OptionsResolver] Fix Options::has() when the value is null

Discussion
----------

[OptionsResolver] Fix Options::has() when the value is null

`isset()` would have returned `false` when the value is `null`
2012-07-30 10:08:33 +02:00
Victor Berchet
a47922b4bf [OptionsResolver] Fix Options::has() when the value is null 2012-07-30 09:38:43 +02:00
Bernhard Schussek
8070e6997e [Form] Fixed ResolvedFormType to really be replaceable 2012-07-29 19:13:45 +02:00
Fabien Potencier
6b39ebc4f8 merged branch bschussek/httpfoundationextension (PR #5103)
Commits
-------

173b929 [Form] Completely decoupled CoreExtension from HttpFoundation

Discussion
----------

[Form] Completely decoupled CoreExtension from HttpFoundation

Bug fix: no
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: -
Todo: -
2012-07-29 16:33:05 +02:00
Bernhard Schussek
173b929219 [Form] Completely decoupled CoreExtension from HttpFoundation 2012-07-29 16:18:04 +02:00
Bernhard Schussek
57ac110e77 [Form] Removed unnecessary method call 2012-07-29 15:49:21 +02:00
Bernhard Schussek
27ab56d8ee [OptionsResolver] Removed LazyOption class and improved performance a tiny bit 2012-07-29 15:25:40 +02:00
Pascal Borreli
910b60de70 [BrowserKit] Added some tests, removed dead code 2012-07-29 12:17:46 +00:00
Fabien Potencier
50652a9717 merged branch pborreli/phpdoctypos (PR #5096)
Commits
-------

6ac8e73 Fixed typos
4c726ea Fixed Phpdoc

Discussion
----------

Fixed some typos
2012-07-29 11:20:51 +02:00
Pascal Borreli
6ac8e7308d Fixed typos 2012-07-28 22:02:29 +00:00
Pascal Borreli
4c726ea64c Fixed Phpdoc 2012-07-28 16:07:17 +00:00
Bernhard Schussek
04cb5bc457 [Form] Removed the ImmutableFormConfig class to save time spent with copying values (+20ms) 2012-07-28 10:59:23 +02:00
Bernhard Schussek
a845a28a76 [Form] Optimized form events to only be created on demand 2012-07-28 08:47:13 +02:00
Fabien Potencier
180f4a66ed merged branch pborreli/filesystem-windows (PR #5088)
Commits
-------

03c3712 [Filesystem] Fixed 2 tests throwing error on windows
3689bb8 [Filesystem] Fixed 3 failing tests on windows

Discussion
----------

[Filesystem] Fixed 5 tests on windows

Fixing 3 test expecting wrong folders :

```
-'C:\Users\pascal\AppData\Local\Temp\\1343425847694\file'
+'C:\Users\pascal\AppData\Local\Temp\1343425847694\file'
```

Fixed 2 tests on Windows caused by symlink function throwing error when first argument is not existent :
```
symlink(): Could not fetch file information(error 2)
```
2012-07-28 08:26:08 +02:00
Fabien Potencier
c56f47141f merged branch Dattaya/framework-bundle/assets-install-command (PR #5084)
Commits
-------

f402a16 [FrameworkBundle] AssetsInstallCommand. Made 'web' as a default folder.

Discussion
----------

[FrameworkBundle] AssetsInstallCommand. Made 'web' as a default folder.

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

>'The target directory (usually "web")'

It is indeed a folder that's usually used to install assets, why not making it as a default value?
2012-07-28 08:22:01 +02:00
Pascal Borreli
03c3712fb3 [Filesystem] Fixed 2 tests throwing error on windows 2012-07-28 02:26:14 +00:00
Pascal Borreli
3689bb8b9d [Filesystem] Fixed 3 failing tests on windows 2012-07-27 21:54:21 +00:00
Yaroslav Kiliba
f402a1643c [FrameworkBundle] AssetsInstallCommand. Made 'web' as a default folder. 2012-07-27 18:49:52 +03:00
Larry Garfield
76815fe664 Allow the targetUrl on a redirect response to be set explicilty. 2012-07-27 09:40:11 -05:00
Pascal Borreli
3e4c9b2824 [Routing] Fixed alteration of $_SERVER 2012-07-27 10:50:12 +00:00
Martin Hasoň
b384c82ea6 [HttpFoundation] Fixed checking IPv6 address without bit-length of the prefix 2012-07-27 11:07:24 +02:00
Fabien Potencier
beb000908c [Finder] fixed various CS issues and added a reference to the relevant PHP bug 2012-07-27 09:35:03 +02:00
Fabien Potencier
7b1d6b806e merged branch alebo/ticket_4922 (PR #4993)
Commits
-------

ae6016c [Finder] Workaround for FilterIterator-FilesystemIterator-rewind issue

Discussion
----------

[Finder] Workaround for the problem with rewind of FilterIterator with inner FilesystemIterator.

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

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

by stof at 2012-07-20T10:28:05Z

Please add some tests

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

by alebo at 2012-07-24T09:50:36Z

Any feedback yet? The new commit includes tests.
2012-07-27 09:24:52 +02:00
Fabien Potencier
87f89706f2 merged branch adrienbrault/patch-2 (PR #5065)
Commits
-------

4d09907 [Serializer] Add a docblock to help type hinting

Discussion
----------

[Serializer] Add a docblock to help type hinting

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-27 09:20:54 +02:00
Fabien Potencier
1da896dc7e merged branch diaspar/2.0-pdosessionstorage-issue3255 (PR #5070)
Commits
-------

9e28593 fixed error on oracle db related to clob data. https://github.com/symfony/symfony/issues/3255

Discussion
----------

fixed error on pdosession storage for oracle db. Related to clob data

Did a change on 2.0 branch to fix this error

https://github.com/symfony/symfony/issues/3255

Tested on mysql and Oracle DB.

I also ran a phpunit test before commit:

phpunit tests/Symfony/Tests/Component/HttpFoundation/SessionStorage/PdoSessionStorageTest.php
PHPUnit 3.6.10 by Sebastian Bergmann.

Time: 0 seconds, Memory: 2.75Mb

OK (3 tests, 5 assertions)

Time: 0 seconds, Memory: 2.75Mb
2012-07-27 07:31:54 +02:00
mauricio lopez
9e285937b9 fixed error on oracle db related to clob data.
https://github.com/symfony/symfony/issues/3255
2012-07-26 11:42:25 -05:00
Bernhard Schussek
9f4178b672 [Validator] Fixed: StaticMethodLoader does not try to invoke methods of interfaces anymore 2012-07-26 16:39:18 +02:00
Fabien Potencier
e1c65fa9c0 merged branch marcw/request-context-params (PR #5059)
Commits
-------

d30943c [FrameworkBundle] Switched to parameters for request context host and scheme

Discussion
----------

[FrameworkBundle] Switched to parameters for request context host and scheme
2012-07-26 16:16:22 +02:00
Fabien Potencier
77ce04d0b1 merged branch bschussek/normalizer-performance (PR #5067)
Commits
-------

d858f7b [OptionsResolver] Optimized previous values of a lazy option not to be evaluated if the second argument is not defined
8a338cb [OptionsResolver] Micro-optimization
e659f0e [OptionsResolver] Improved the performance of normalizers

Discussion
----------

[OptionsResolver] Improved the performance of normalizers

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

Normalizers are now stored in the Options instance only once. Previously, normalizers were stored in Options upon resolving, which meant that they were added a lot of time if the same resolver was used for many different options arrays.

This improvement led to an improvement of 30ms on http://advancedform.gpserver.dk/app_dev.php/taxclasses/1

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

by beberlei at 2012-07-26T13:34:23Z

@bschussek do you have the code for this forms somewhere btw?

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

by bschussek at 2012-07-26T13:54:52Z

@beberlei https://github.com/stof/symfony-standard/tree/twig_forms
2012-07-26 15:55:52 +02:00
Bernhard Schussek
d858f7bdf3 [OptionsResolver] Optimized previous values of a lazy option not to be evaluated if the second argument is not defined 2012-07-26 15:36:09 +02:00
Bernhard Schussek
8a338cb6fa [OptionsResolver] Micro-optimization 2012-07-26 15:32:18 +02:00
Bernhard Schussek
e659f0e39d [OptionsResolver] Improved the performance of normalizers
Normalizers are now stored in the Options instance only once. Previously,
normalizers were stored in Options upon resolving, which meant that
they were added a lot of time if the same resolver was used for many
different options arrays.

This improvement led to an improvement of 30ms on
advancedform.gpserver.dk/app_dev.php/taxclasses/1
2012-07-26 15:21:14 +02:00
Adrien Brault
4d09907362 [Serializer] Add a docblock to help type hinting 2012-07-26 15:58:31 +03:00
marc.weistroff
d30943c2e8 [FrameworkBundle] Switched to parameters for request context host and scheme 2012-07-26 11:12:14 +02:00
Bernhard Schussek
6e59e6b085 [Form] Fixed: setData() is now guaranteed to be invoked before bind() 2012-07-26 10:55:40 +02:00
Bernhard Schussek
ef747ff767 [Form] Fixed exception message in ObjectChoiceList 2012-07-26 08:30:26 +02:00
Fabien Potencier
b122b37be7 [Security] tweaked previous merge 2012-07-26 08:13:41 +02:00
Jonathan Ingram
9030dc5dfc [Security] add docblocks to InteractiveLoginEvent
Close #5053 (was easier to just create a new PR).
2012-07-26 16:07:46 +10:00
Tobias Schultze
4a5dadb520 [Form] raise exception when label for choice cannot be read 2012-07-26 01:10:54 +02:00
Tobias Schultze
a3cbf6bbf6 [Form] add type hint in ChoiceList 2012-07-26 01:10:53 +02:00
Tobias Schultze
805393303c [Form] fix ChoiceList and ObjectChoiceList when choices is a Traversable 2012-07-26 01:10:52 +02:00
Tobias Schultze
6f7ea8dbbe [Form] fix ObjectChoiceList when property path is '0' 2012-07-26 01:05:13 +02:00
Tobias Schultze
8da33eb5bc [Form] fixed phpdoc of ChoiceList 2012-07-26 01:05:12 +02:00
Fabien Potencier
c7bc4791c4 merged branch bschussek/issue5029 (PR #5046)
Commits
-------

2607390 [Form] Fixed SearchAndRenderBlockNode to really ignore empty labels

Discussion
----------

[Form] Fixed SearchAndRenderBlockNode to really ignore empty labels

Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: #5029
Todo: -
2012-07-25 22:54:22 +02:00
Bernhard Schussek
0315d431f4 [Form] Fixed failing UniqueValidatorTest when Doctrine Common 2.2 is loaded 2012-07-25 22:49:37 +02:00
Bernhard Schussek
b4b5408fdc [Form] Fixed failing tests 2012-07-25 22:16:38 +02:00
Fabien Potencier
2ca73f9d7e merged branch pborreli/posix-fix (PR #5047)
Commits
-------

1d6611b [Filesystem] Fixed tests on system without posix

Discussion
----------

[Filesystem] Fixed tests on system without posix

Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: master is broken
Fixes the following tickets: None
License of the code: MIT
2012-07-25 21:26:35 +02:00
Bernhard Schussek
9622703302 [Validator] Removed the Size constraint which did not exist in 2.0 2012-07-25 20:30:38 +02:00
Bernhard Schussek
2607390309 [Form] Fixed SearchAndRenderBlockNode to really ignore empty labels 2012-07-25 19:15:43 +02:00
Pascal Borreli
1d6611be50 [Filesystem] Fixed tests on system without posix 2012-07-25 17:04:57 +00:00
Bernhard Schussek
eeb66dd2ef [Form] Renamed the internal FormView variables "types" and "full_block_name" 2012-07-25 17:35:06 +02:00
Bernhard Schussek
6b17640647 [Form] Fixed caching of block names when types of forms with the same unique block ID differ 2012-07-25 17:31:36 +02:00
Bernhard Schussek
2a3235ac22 [Validator] Fixed group sequence support in the XML and YAML drivers 2012-07-25 17:27:01 +02:00
Fabien Potencier
2bc358dbcd merged branch bschussek/issue5029 (PR #5042)
Commits
-------

fb002d8 [Form] Fixed variable passing from outer to inner blocks of the same FormView instance

Discussion
----------

[Form] Fixed variable passing from outer to inner blocks of the same FormView instance

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

This PR fixes two bugs.

The first bug is described in #5029. The second parameter to the "form_label" function in Twig, if given, always overwrote whatever label was defined previously.

```
{# null would overwrite whatever is currently set #}
form_label(form, null, { ... })
```

The second bug affected passing variables from outer to inner blocks. In the following example, "label_attr" would not be forwarded to the "form_label" function.

```
form_row(form, { "label_attr": { "class": "my_class" }})
```

Both bugs are fixed now.
2012-07-25 17:21:35 +02:00
Fabien Potencier
b52cbf46d0 merged branch gedrox/patch-1 (PR #5041)
Commits
-------

0ea3769 Fix not recognized "type" option exception

Discussion
----------

[Form] Fixed not recognized "type" option exception

The exception about not recognized "type" option was raised when "date", "datetime", "time" type was guessed by validator type guesser using the date related constraint.

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

by bschussek at 2012-07-25T11:30:23Z

Thanks! 👍
2012-07-25 17:21:08 +02:00
Fabien Potencier
950fff2790 merged branch bschussek/data (PR #5023)
Commits
-------

686bf6b [Form] Made original data of a form and choices accessible in templates

Discussion
----------

[Form] Made original data of a form and choices accessible in templates

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

Now you can access the normalized data of a form in the template:
```
form.vars.data
```
You can also access the original data of a choice, for example the entities in an entity type:
```
choice.data
```
2012-07-25 17:18:20 +02:00
Bernhard Schussek
fb002d89ea [Form] Fixed variable passing from outer to inner blocks of the same FormView instance 2012-07-25 13:20:23 +02:00
gedrox
0ea3769664 Fix not recognized "type" option exception
The exception about not recognized "type" option was raised when "date", "datetime", "time" type was guessed by validator type guesser using the date related constraint.
2012-07-25 14:05:22 +03:00
Fabien Potencier
f4570d5e73 merged branch acasademont/use_referer_with_route_name (PR #5037)
Commits
-------

307d99c [Security] Fixed use_referer option not working properly when login_path is a route name

Discussion
----------

[Security] Fixed use_referer option not working properly when login_path...

... is a route name

When use_referer is set to true and the request comes from the login page,
the user should not be redirected to the login form again (the referer) but
to the default_target_path. The problem arises when our login_path option
is not a path but a route name, as the ```getUriForPath()``` method is not
made to create routes from route names.

Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: [![Build Status](https://secure.travis-ci.org/acasademont/symfony.png?branch=master)](http://travis-ci.org/acasademont/symfony)
Fixes the following tickets: -
Todo: -
License of the code: MIT
Documentation PR: -

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

by stloyd at 2012-07-24T16:24:28Z

👍
2012-07-25 11:37:42 +02:00
Fabien Potencier
965fe3258b [HttpFoundation] fixed a PHP Notice (refs #5034) 2012-07-25 09:38:36 +02:00
Fabien Potencier
207124c973 fixed CS 2012-07-25 07:24:06 +02:00
Albert Casademont
307d99c8f6 [Security] Fixed use_referer option not working properly when login_path is a route name
When use_referer is set to true and the request comes from the login page,
the user should not be redirected to the login form again (the referer) but
to the default_target_path. The problem arises when our login_path option
is not a path but a route name, as the ```getUriForPath()``` method is not
made to create routes from route names.
2012-07-24 17:37:00 +02:00
Julien Pauli
286d03b5d2 Fix for #5033 2012-07-24 17:11:14 +02:00
Fabien Potencier
2aaa4ed84e bumped Symfony version to 2.1.0-DEV 2012-07-23 19:27:52 +02:00
Bernhard Schussek
686bf6b664 [Form] Made original data of a form and choices accessible in templates 2012-07-23 19:24:46 +02:00
Fabien Potencier
d81b9f56cb updated VERSION for 2.1.0-BETA4 2012-07-23 19:10:10 +02:00
Fabien Potencier
a5451e48b7 fixed typo 2012-07-23 18:54:03 +02:00
Fabien Potencier
8d33ba9fc5 merged 2.0 2012-07-23 16:25:26 +02:00
Fabien Potencier
bceb28ff7a merged branch parhs/2.0 (PR #5005)
Commits
-------

5bfc25e Fixed buildViewBottomUp docs

Discussion
----------

Fixed buildViewBottomUp docs

Fixed documentation
2012-07-23 16:23:36 +02:00
Fabien Potencier
76c1e26272 moved deps in recommend to suggest 2012-07-23 16:23:01 +02:00
Grégoire Pineau
e1f1d3a1f7 Added missing property 2012-07-23 16:09:36 +02:00
Fabien Potencier
f58c27544d merged branch drak/nativefile_savepath (PR #5016)
Commits
-------

ff273af [HttpFoundation][Sessions] Micro-optimization
9bf3cb4 [HttpFoundation][Sessions] Add support for extended save_path for native files save handler

Discussion
----------

[Sessions] Add support for extended save_path for native files save handler

Bug fix: no
Feature addition: yes
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: #4908
Todo: -
License of the code: MIT
Documentation PR: -
2012-07-23 15:55:36 +02:00
Drak
ff273af546 [HttpFoundation][Sessions] Micro-optimization 2012-07-23 12:18:38 +01:00
Bilal Amarni
91415b1371 removed unneeded class to compile 2012-07-23 12:27:23 +03:00
Drak
9bf3cb4e97 [HttpFoundation][Sessions] Add support for extended save_path for native files save handler 2012-07-23 09:59:09 +01:00
Fabien Potencier
c20c1d18dc merged branch bschussek/propertypath (PR #5011)
Commits
-------

dd2aa54 [Form] Disabled manual singulars in PropertyPath until the syntax is finalized

Discussion
----------

[Form] Disabled manual singulars in PropertyPath until the syntax is finalized

Bug fix: no
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: -
Todo: -
2012-07-22 10:03:04 +02:00
Fabien Potencier
4bafd1d788 [FrameworkBundle] removed temporary XDebug hack as the nesting issue has been resolved now 2012-07-22 10:02:56 +02:00
Bernhard Schussek
dd2aa54e15 [Form] Disabled manual singulars in PropertyPath until the syntax is finalized 2012-07-22 09:58:31 +02:00
Fabien Potencier
214e0554be merged branch bschussek/renderer (PR #5006)
Commits
-------

dc3a680 [Form] Improved FormRenderer API to reduce the size of the function call stack during rendering

Discussion
----------

[Form] Improved FormRenderer API to decrease the function call stack

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

This PR reduces the function call stack size when rendering by directly calling the methods `renderBlock` and `searchAndRenderBlock` (formerly `renderSection`) and removing the delegating methods `render(Widget|Label|Row|...)`.

It breaks BC in that PHP templates now need to pass the FormView instance to `block` (formerly `renderBlock`). This is necessary, otherwise that function may behave buggy in special circumstances.

Otherwise this PR cleans up API method and parameter names to improve clarity.
2012-07-22 09:50:28 +02:00
Bernhard Schussek
eccc5bd0c6 [Form] Restored BC in AbstractType::getDefaultOptions() and getAllowedOptionValues() 2012-07-22 09:36:58 +02:00
Bernhard Schussek
dc3a680cd3 [Form] Improved FormRenderer API to reduce the size of the function call stack during rendering 2012-07-22 09:29:35 +02:00
Fabien Potencier
1be155ab8c [HttpFoundation] never send a 304 for non-safe HTTP methods 2012-07-21 21:52:19 +02:00
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
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
ddebree
37bbd0f60a Moved symfony/config from the "recommend" dependency to the "suggest" dependency. Cannot find "recommend" in composer documentation 2012-07-21 13:17:54 +03:00
parhs
5bfc25e6b3 Fixed buildViewBottomUp docs 2012-07-21 00:54:17 +03:00
Alex Bogomazov
ae6016c6fc [Finder] Workaround for FilterIterator-FilesystemIterator-rewind issue 2012-07-20 19:29:53 +03: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
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
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
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
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
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
Fabien Potencier
ebea32c40d merged branch guilhermeblanco/patch-9 (PR #4949)
Commits
-------

1f33756 Update master

Discussion
----------

Allow HttpKernel ->render to be called directly

Hi,

I faced this problem in a funny situation.
Working on tests of individual components, I want to be able to test sub-requests. These elements are not mapped directly, relying on `FrameworkBundle` routing internal to achieve its goal.

The nature of my application leads to fully decoupled bundles, being a website responsible to define everything, from app configuration to routing elements. That way, an individual bundle controller don't know the route it should call, leading the test to be harder to do.

Together with this situation, it is also required in my testing scenario to be able to test the real world execution, then being an ESI include (a sub-request). This test then needs to be able to directly call controller to be rendered. That said, `HttpKernel` provides an API that does exactly what is required to achieve my goal, calling `render()` which triggers the sub-request and also accepts options which allows me to test the real world scenarios.
But as soon as you trigger the method, `ProfileListener` intercepts the kernel response to collect profiling information. Under this specific situation, since you called directly `render`, there's no master request, then leading the test to fail with the following PHP warning:

```
Warning: SplObjectStorage::offsetExists() expects parameter 1 to be object, boolean given in /var/www/nde/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/EventListener/ProfilerListener.php line 120
```

To fix that, all that is needed is a check for a possible parent request. That's the purpose of this patch. =)

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

by stof at 2012-07-17T15:11:13Z

This looks good to me, but as said on IRC, a test should be added to avoid regressions
2012-07-18 10:22:46 +02:00
Fabien Potencier
f6815be7f2 [FrameworkBundle] raised the max nesting level for XDebug for tests to pass 2012-07-18 10:19:41 +02:00
Fabien Potencier
e0409f5218 fixed some tests 2012-07-18 10:08:52 +02:00
Fabien Potencier
0598043cef removed unneeded echo 2012-07-18 09:46:34 +02:00
Fabien Potencier
1570db9646 merged branch bschussek/performance (PR #4918)
Commits
-------

1474aa5 [Form] Fixed consideration of Twig's template inheritance and added another performance-improving check
b4ec7f5 Fixed my rubbish English
d11f8b5 [Form] Fixed passing of variables in the FormRenderer
629093e [Form] Extracted common parts of FormHelper and FormExtension into separate classes
216c539 [Form] Implemented a more intelligent caching strategy in FormHelper (PHP +100ms, Twig +100ms)

Discussion
----------

[Form] Merged FormHelper and FormExtension and implemented a better caching strategy

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

This PR extracts common parts of `FormHelper` and `FormExtension` into implementations of the new interfaces `FormRendererInterface` and `FormRendererEngineInterface`. The implemented `AbstractRendererEngine` features a more intelligent caching strategy than the one used before. When this strategy was implemented directly in `FormHelper`, the performance of [this specific, heavy form](http://advancedform.gpserver.dk/app_dev.php/taxclasses/1) could be improved from **2.5** to **2.25 seconds** on my machine for PHP templates.

Due to the abstraction and delegation, the performance gain is not that big anymore, but we still have a performance gain of about **0.1 seconds** for both PHP and Twig in the above example. The second, big improvement of this PR is maintainability - the differences between PHP and Twig templates are now contained in relatively small classes - and extendability (it is very easy now to support different template engines).

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

by stof at 2012-07-14T13:47:19Z

should a similar refactoring be done for the [Twig rendering](https://github.com/symfony/symfony/blob/master/src/Symfony/Bridge/Twig/Extension/FormExtension.php) ?

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

by bschussek at 2012-07-14T13:49:25Z

Yes. I would like to merge the common parts of Twig's FormExtension and PHP's FormHelper into an abstract class. Before that I need to have a [working, heavy Twig Form](https://twitter.com/webmozart/status/224135287377371138) in order to measure whether I don't actually decrease the performance with Twig. Can you help me there?

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

by vicb at 2012-07-16T21:48:24Z

Would it make sense to create a 'renderer' folder in the form component and move related classes there ?

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

by stof at 2012-07-16T22:06:58Z

@vicb It makes sense to keep the Twig renderer in the brisge. This is what the bridge is about. Moving the Twig class to the component would not be consistent. And the PHP renderer is already in the component (but it could make sense to move the helper from FrameworkBundle to the TemplatingExtension of the Form component though)

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

by vicb at 2012-07-16T22:16:50Z

@stof I was only referring to the classes located in the Component/Form folder.

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

by vicb at 2012-07-16T22:27:27Z

Overall I don't really know what to think of this PR. PHP and Twig use a different way to support blocks:

- PHP has one block per file,
- Twig could have many blocks per templates.

I am not sure if this PR is optimal for Twig and improves maintainability ?

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

by stof at 2012-07-16T22:46:11Z

@vicb it avoids duplicating the whole rendering logic for each engine (there is at least a third one in [SmartyBundle](https://github.com/noiselabs/SmartyBundle/blob/master/Extension/FormExtension.php) btw)

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

by bschussek at 2012-07-17T07:16:42Z

@vicb I don't think a renderer subfolder makes sense. The interfaces belong to the main namespace, and then the subfolder would only contain two classes.

Considering maintainability for Twig, I think that this PR in fact increases it. TwigExtension before always had to check the whole type hierarchy, while now the code in AbstractRendererEngine makes sure that this process is speeded up.

Before:
```
load _some_entity_field_label:
    - check _some_entity_field_label
    - check entity_label
    - check choice_label
    - check form_label

load _some_other_entity_field_label
    - check _some_other_entity_field_label
    - check entity_label
    - check choice_label
    - check form_label

a.s.o.
```

After:
```
load _some_entity_field_label:
    - check _some_entity_field_label
    - check entity_label (hits the cache if entity_label was checked before)
    - check choice_label (hits the cache if choice_label was checked before)
    - check form_label

load _some_other_entity_field_label
    - check _some_other_entity_field_label
    - check entity_label (now definitely hits the cache)

a.s.o.
```

Since many fields share the same ancestors in the inheritance tree, this definitely improves performance.

As can also be deducted here, custom block names such as `_some_entity_field_label` are now a major drawback. There is nothing we can cache for them, so they need to be checked for every individual block that we load. Removing this feature surprisingly gains no performance for Twig (I need to investigate why at some point), but it speeds up rendering for **250ms** using the PHP engine on [this example form](advancedform.gpserver.dk/app_dev.php/taxclasses/1), dropping the rendering time from 1.25 to 1 sec on my local machine. I'm not sure what we should do here.

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

by stof at 2012-07-17T07:21:31Z

@bschussek could it be possible to have an implementation checking the custom block and another one skipping it ? This way, the user could disable this feature when he does not need it.

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

by bschussek at 2012-07-17T07:38:34Z

@stof It would be possible to add a switch to `FormRenderer` that controls whether custom blocks are checked or not.

If this switch is disabled by default, we break BC. If this switch is enabled by default, it will be pretty useless. People will start designing away for custom blocks, and once they want to improve performance, they can't turn off the switch anymore because it would require too many changes.

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

by stof at 2012-07-17T08:08:38Z

@fabpot what do you think about it ?

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

by bschussek at 2012-07-17T08:41:43Z

Another option that just came to mind is to remove inheritance checks for anything but _widget and _row. I.e., if we render `entity_widget`, check
```
_id_widget
entity_widget
choice_widget
form_widget
```
But if we render `entity_label`, only check
```
_id_label
form_label
```

This improves PHP Templating for **170ms** and Twig for **20ms**. We gain another **150ms** for PHP Templating and **~15ms** for Twig if we also restrict custom fields (_id_widget) to the _widget and _row suffixes (it's really hard to tweak the renderer for Twig.. I think a lot of its performance bottlenecks lie in Twig itself).

Do you have any data on how often blocks other than _widget and _row are customized for specific types/IDs?

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

by stof at 2012-07-17T09:47:38Z

Well, I think most of the time other blocks are not even customized based on the type :)

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

by Tobion at 2012-07-17T14:32:39Z

From my experience rendering the form components individually is easier and more flexible than customizing by ID or type.
But there are still use cases for customizing like library-like bundles (e.g. Bootstrap).
2012-07-18 08:33:15 +02:00
Fabien Potencier
242a388ea4 merged branch bschussek/optionsresolver (PR #4945)
Commits
-------

610c602 [OptionsResolver] Slightly tweaked the performance of the Options class

Discussion
----------

[OptionsResolver] Slightly tweaked the performance of the Options class

Bug fix: no
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: -
Todo: -
2012-07-17 23:06:01 +02:00
Fabien Potencier
34c2bf75e0 merged branch bschussek/phpengine_cache_escape (PR #4942)
Commits
-------

0d0a968 [Templating] Cached the result of escape() in order to improve performance (+470ms)

Discussion
----------

[Templating] Cached the result of escape() in order to improve performance

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

This improvement gains **400ms** of rendering speed on [this particular example page](http://advancedform.gpserver.dk/app_dev.php/taxclasses/1).

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

by lsmith77 at 2012-07-16T17:36:50Z

i guess we don't have to be concerned with increased memory usage here .. if at all we could offer a clear cache method in case someone is f.e. using this to generate tons of messages in a cron job.

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

by henrikbjorn at 2012-07-17T06:39:52Z

The example form is broken.

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

by bschussek at 2012-07-17T07:21:26Z

The source code for the form can be found [here](https://github.com/stof/symfony-standard/blob/twig_forms/src/AdvancedForm/CoreBundle/Form/TaxClassType.php).

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

by henrikbjorn at 2012-07-17T07:28:11Z

But i am guessing this is only for php not twig :P

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

by bschussek at 2012-07-17T07:41:07Z

Obviously..
2012-07-17 22:45:12 +02:00
Fabien Potencier
8754c0c33f merged branch stof/doctrine_2_3 (PR #4941)
Commits
-------

8f99be3 [DoctrineBridge] Fixed the type guesser for doctrine 2.3

Discussion
----------

[DoctrineBridge] Fixed the type guesser for doctrine 2.3

Doctrine 2.3 now uses the drivers moved to Common, so the exception was not catched anymore and was breaking the guessing when a non-entity was used.

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

by craue at 2012-07-16T14:54:30Z

👍

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

by ddeboer at 2012-07-17T20:07:57Z

👍

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

by stof at 2012-07-17T20:17:01Z

@fabpot please merge this as 2.1 is currently broken when you rely on the form guessers for unmapped classes
2012-07-17 22:45:07 +02:00
Fabien Potencier
f52ce61782 merged branch bschussek/issue4125 (PR #4953)
Commits
-------

17ca9b6 [Form] Fixed DoctrineType to use getManagerForClass() if no EM name is given

Discussion
----------

[Form] Fixed DoctrineType to use getManagerForClass() if no EM name is given

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

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

by stof at 2012-07-17T08:16:59Z

👍
2012-07-17 11:07:53 +02:00
Bernhard Schussek
17ca9b671a [Form] Fixed DoctrineType to use getManagerForClass() if no EM name is given 2012-07-17 10:16:11 +02:00
Bernhard Schussek
1474aa5fa2 [Form] Fixed consideration of Twig's template inheritance and added another performance-improving check 2012-07-17 09:02:04 +02:00
Jonathan Ingram
764b1dea62 [FrameworkBundle] minor typo in controller action docblock 2012-07-17 15:02:05 +10:00
Guilherme Blanco
1f3375695c Update master 2012-07-17 00:00:12 -03:00
Bernhard Schussek
610c602b06 [OptionsResolver] Slightly tweaked the performance of the Options class 2012-07-16 22:35:31 +02:00
Bernhard Schussek
b4ec7f54eb Fixed my rubbish English 2012-07-16 21:54:46 +02:00
Bernhard Schussek
d11f8b5e9e [Form] Fixed passing of variables in the FormRenderer 2012-07-16 21:39:30 +02:00
Bernhard Schussek
629093ed25 [Form] Extracted common parts of FormHelper and FormExtension into separate classes 2012-07-16 21:39:27 +02:00
Bernhard Schussek
0d0a968800 [Templating] Cached the result of escape() in order to improve performance (+470ms) 2012-07-16 18:29:06 +02:00
Bernhard Schussek
216c539e41 [Form] Implemented a more intelligent caching strategy in FormHelper (PHP +100ms, Twig +100ms) 2012-07-16 18:04:36 +02:00
Christophe Coevoet
8f99be39ab [DoctrineBridge] Fixed the type guesser for doctrine 2.3 2012-07-16 16:48:22 +02:00
Fabien Potencier
151b79a6ce bumped Symfony version to 2.1.0-DEV 2012-07-15 20:27:15 +02:00
Fabien Potencier
c4b5d6d7fe simplified code 2012-07-15 20:06:17 +02:00
Fabien Potencier
613445fd0f updated VERSION to 2.1.0-BETA3 2012-07-15 20:05:02 +02:00
Fabien Potencier
91da592c7c fixed typo (thanks @stof) 2012-07-15 20:03:01 +02:00
Fabien Potencier
8c32a8e936 fixed guessRoute() 2012-07-15 19:49:08 +02:00
Fabien Potencier
8f82e07429 made RequestDataCollector from HttpKernel and FrameworkBundle compatible 2012-07-15 19:07:14 +02:00
Fabien Potencier
dd8a401e68 made the Kernel dep optional in ConfigDataCollector 2012-07-15 19:03:03 +02:00
Fabien Potencier
0875124fee moved the router data collector to HttpKernel 2012-07-15 18:35:25 +02:00
Jordan Alliot
e43a5c7b0d [Security] Changed logger channel for default auth failure handler 2012-07-15 18:55:17 +03:00
Fabien Potencier
26c21c98bf merged branch bamarni/patch-1 (PR #4933)
Commits
-------

b4d1bdf [Form] added a bc break note about the tag alias matching

Discussion
----------

[Form] added a bc break note about the tag alias matching

6489a65960 is a BC break if we were relying on the previous behavior.
2012-07-15 15:43:33 +02:00
Fabien Potencier
b255db5ca0 [WebProfilerBundle] made WebDebugToolbarListener implement EventSubscriberInterface 2012-07-15 15:41:19 +02:00
Bilal Amarni
b4d1bdf9e6 [Form] added a bc break note about the tag alias matching 2012-07-15 16:34:11 +03:00
Fabien Potencier
93cbdfdd62 Revert "merged branch stof/serializable_role (PR #4925)"
This reverts commit b0750f6dcd, reversing
changes made to d09bfe7552.
2012-07-15 14:58:33 +02:00
Fabien Potencier
2644f1c2f5 [WebProfilerBundle] removed remaining request retrieval from the container 2012-07-15 14:45:43 +02:00
Fabien Potencier
b0750f6dcd merged branch stof/serializable_role (PR #4925)
Commits
-------

1f2f866 fixed the serialization of the SwitchUserRole
b55930a [Security] Implemented the Serializable interface in the Role class

Discussion
----------

[Security] Implemented the Serializable interface in the Role class

The Role class is serialized in the session for each role of the user. Implementing the Serializable interface allows to reduce the size of the data.
2012-07-15 14:10:42 +02:00
Fabien Potencier
cd24e6ea8f Revert "raised the minimum version of PHP to 5.3.4 (closes #3856)"
This reverts commit 2dcc44897e.
2012-07-15 12:13:51 +02:00
Fabien Potencier
9841ba4213 [HttpFoundation] removed buffer flushing in Response when on the CLI 2012-07-15 10:55:34 +02:00
Fabien Potencier
80840fcd69 merged branch asm89/default-logout-success-handler (PR #4921)
Commits
-------

df2406f [Security] Add note to changelog about BC break
01b2e39 [Security] Extract default logout success handling logic

Discussion
----------

[Security] Extract default logout success handling logic

Bug fix: no
Feature addition: no
Backwards compatibility break: yes, small one for people using the component
Symfony2 tests pass: [![Build Status](https://secure.travis-ci.org/asm89/symfony.png?branch=default-logout-success-handler)](http://travis-ci.org/asm89/symfony)
License of the code: MIT

As discussed earlier with @fabpot and @schmittjoh. This PR extracts the default logout success handling logic to a separate class that users can extend.

Note: build status is red, but that is because of a failing performance test in the form component? ..
2012-07-15 10:12:14 +02:00
Fabien Potencier
d7a5449dda [HttpFoundation] tweaked previous merge 2012-07-15 09:31:47 +02:00
Fabien Potencier
4513210276 merged branch pounard/master (PR #4914)
Commits
-------

7d53909 Earlier PHP output buffer flush for non FPM environments

Discussion
----------

Earlier PHP output buffer flush for non FPM environments

In the Response::send() method you are calling the fastcgi_finish_request() in case it exists. This will provide a respectful performance boost when you have significant work being done by listeners acting on kernel terminal events; Sadly you are forgetting people that don't use FPM doing this.

The performance boost for a Vanilla PHP is not much: flushing earlier potentially helps higher layers such as the HTTPd or potential other cache layers: the sooner their buffer gets filled, the sooner they release information to the browser, even if the output buffer is still open. The explicit flush() is supposed to do exactly this.
2012-07-15 09:29:03 +02:00
Fabien Potencier
0713517971 merged branch asm89/form-performance (PR #4923)
Commits
-------

33f29ed [Form] '@group benchmark' for form performance tests

Discussion
----------

[Form] '@group benchmark' for form performance tests

Bug fix: no
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: [![Build Status](https://secure.travis-ci.org/asm89/symfony.png?branch=form-performance)](http://travis-ci.org/asm89/symfony)
License of the code: MIT

I think a PR or note about this has been rejected before, but since build statuses on PRs sometimes seem to fail if travis is busy I think moving the form performance tests to `@group benchmark` should be reconsidered.

Edit: even master is currently failing on this
2012-07-15 09:26:15 +02:00
Fabien Potencier
4e5b80661f merged branch danielholmes/validator_inheritdoc (PR #4931)
Commits
-------

07992d3 [Validator] Added inheritDoc phpdoc for validate methods

Discussion
----------

[Validator] Added inheritDoc phpdoc for validate methods

Was instructed by @stof to do this for a PR on comparison validators and noticed none of the validators used inheritDoc.

Bug fix: no
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: n/a
Todo: I haven't looked around too much, but I assume if none of the validators followed this standard that there would be a fair few other classes not using. Obviously not a big issue though
License of the code: MIT
Documentation PR: n/a
2012-07-15 09:24:18 +02:00
Fabien Potencier
cf146c0c01 merged branch drak/flashbag_default (PR #4926)
Commits
-------

5ae0da0 Update changelogs
ff91b9a [FrameworkBundle] Make FlashBag the default.

Discussion
----------

[2.1][FrameworkBundle] Make FlashBag the default.

Bug fix: no
Feature addition: yes
Backwards compatibility break: yes (but only technically)
Symfony2 tests pass: yes
Fixes the following tickets: -
Todo: -
License of the code: MIT

The difference between `AutoExpireFlashBag` and `FlashBag` is simply that the first will expire flashes regardless of being displayed on the next pageload.  This can result in lost messages. It was created simply for BC with 2.0.

`FlashBag` expires flashes once they are retrieved. This also makes it ESI compatible.

/cc @lsmith77

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

by jalliot at 2012-07-14T18:13:40Z

+1!
You should add it to the changelog and upgrade files though :)
2012-07-15 09:23:39 +02:00
Fabien Potencier
a539858dd3 [Translation] fixed typo 2012-07-15 09:21:44 +02:00
Fabien Potencier
3fff47acff merged branch weaverryan/message-selector-exception (PR #4929)
Commits
-------

480ab14 Further improving the MessageSelector exception

Discussion
----------

Further improving the MessageSelector exception

Hey guys!

The goal is just to give the users a better starting point when they see this exception.

See previous change in #4173 and conversation in #4207

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

Thanks!

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

by stof at 2012-07-14T23:11:17Z

Shouldn't it be done in 2.0 instead ?

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

by weaverryan at 2012-07-15T00:15:42Z

I decided to go against 2.1 when I saw that #4173 was against 2.0. If we do it against 2.0, it'll cause a conflict when 2.0 is merged into master - seemed like too much trouble for such a small change.
2012-07-15 09:20:46 +02:00
Daniel Holmes
07992d352c [Validator] Added inheritDoc phpdoc for validate methods 2012-07-14 17:42:20 -07:00
Ryan Weaver
480ab14a33 Further improving the MessageSelector exception
See previous change in #4173 and conversation in #4207
2012-07-14 18:05:33 -05:00
Drak
5ae0da015d Update changelogs 2012-07-14 22:43:03 +01:00
excelwebzone
c4ead527b3 [Validator] more updated hebrew messages 2012-07-14 14:32:16 -07:00
Drak
ff91b9aed0 [FrameworkBundle] Make FlashBag the default.
This makes the full stack framework ESI compatible.
2012-07-14 18:24:10 +01:00
Fabien Potencier
36d12dde5b merged branch stof/serializer_improvement (PR #4904)
Commits
-------

12bdec3 Moved the NormalizationAwareInterface check to the ChainEncoder
28e137c [Serializer] Added a ChainEncoder and a ChainDecoder

Discussion
----------

[Serializer] Added a ChainEncoder and a ChainDecoder

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

These classes contains the logic previously defined in the Serializer itself to handle the choice of a serializer. This allows reusing it when using only the encoding part of the component, without having to use the Serializer class (which is not as handy to bootstrap when you want to use only encoders and decoders as normalizers come first)

I was wondering if these classes should have adders but I kept the constructor injection only to be consistent with the current code (encoders cannot be registered after the instantiation) and to avoid implementing the SerializerAwareInterface in them (to allow injecting the Serializer in serializer-aware encoders and decoders added later).

Note that this change is fully BC as it only changes the internal implementation of the Serializer.

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

by fabpot at 2012-07-14T11:07:32Z

ping @lsmith77 @Seldaek

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

by Seldaek at 2012-07-14T15:17:42Z

After a quick look, I'd say +1
2012-07-14 18:10:40 +02:00
Fabien Potencier
4dd47ac17b merged branch excelwebzone/validator (PR #4924)
Commits
-------

ddbb26e [Validator] updated hebrew messages

Discussion
----------

[Validator] updated hebrew messages
2012-07-14 18:09:33 +02:00
Christophe Coevoet
1f2f866fff fixed the serialization of the SwitchUserRole 2012-07-14 18:00:37 +02:00
Christophe Coevoet
b55930a45b [Security] Implemented the Serializable interface in the Role class 2012-07-14 17:42:15 +02:00
excelwebzone
ddbb26e5ae [Validator] updated hebrew messages 2012-07-14 08:21:09 -07:00
Alexander
33f29ed174 [Form] '@group benchmark' for form performance tests 2012-07-14 16:20:31 +02:00
Alexander
df2406f286 [Security] Add note to changelog about BC break 2012-07-14 16:07:27 +02:00
Alexander
01b2e3946c [Security] Extract default logout success handling logic 2012-07-14 16:07:08 +02:00
Christoph Schaefer
a80ef6b482 Fixed: The type name specified for the service propel.form.type.model does not match the actual name 2012-07-14 16:45:00 +03:00
Fabien Potencier
28abff8147 merged branch hason/czech_validator_messages (PR #4919)
Commits
-------

42cfd25 [Validator] updated czech messages

Discussion
----------

[Validator] updated czech messages
2012-07-14 15:40:18 +02:00
Martin Hasoň
42cfd259ac [Validator] updated czech messages 2012-07-14 15:37:06 +02:00
Fabien Potencier
11f8cf0520 merged branch Dattaya/form/test-error (PR #4916)
Commits
-------

dbd169f [Form] Error in the SimpleFormTest case.

Discussion
----------

[Form] Error in the SimpleFormTest case.

Symfony2 tests pass: yes

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

by bschussek at 2012-07-14T13:25:28Z

Thanks, looks like a copy paste error. @fabpot 👍
2012-07-14 15:30:15 +02:00
Fabien Potencier
baf990b762 [HttpKernel] fixed the request data collector which always started the session (closes #4915) 2012-07-14 15:04:55 +02:00
Yaroslav Kiliba
dbd169f82e [Form] Error in the SimpleFormTest case. 2012-07-14 16:02:46 +03:00
Pierre Rineau
7d53909d47 Earlier PHP output buffer flush for non FPM environments 2012-07-14 14:47:09 +02:00
Fabien Potencier
dcf933be39 merged branch jalliot/exception-profiler-logs (PR #4912)
Commits
-------

1764574 [TwigBundle] Improved logs display on exception page

Discussion
----------

[TwigBundle] Improved logs display on exception page

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

* Add the priority level in front of log entries
* Better display of warnings
2012-07-14 14:37:46 +02:00
Mephistofeles
d26f133e6a [Validator] [Resources] fixed polish validator translated messages for polish locale
Added pluralization support and translated new messages.
2012-07-14 14:08:31 +02:00
Jordan Alliot
1764574198 [TwigBundle] Improved logs display on exception page 2012-07-14 13:58:32 +02:00
Fabien Potencier
c99b10804b merged branch stof/form_safeguard (PR #4910)
Commits
-------

6489a65 [Form] Added an exception for invalid type services

Discussion
----------

[Form] Added an exception for invalid type services

Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes [![Build Status](https://secure.travis-ci.org/stof/symfony.png?branch=form_safeguard)](http://travis-ci.org/stof/symfony) (Travis fails randomly for the performance test)
Fixes the following tickets: -
Todo: -

Before the introduction of the FormRegistry, the getName() method was
never used for types registered through the DI container. The
FormRegistry now uses the getName() method and missconfigured services
will trigger a notice.
This was reported in FriendsOfSymfony/FOSCommentBundle#234
2012-07-14 13:41:41 +02:00
Christophe Coevoet
6489a65960 [Form] Added an exception for invalid type services
Before the introduction of the FormRegistry, the getName() method was
never used for types registered through the DI container. The
FormRegistry now uses the getName() method and missconfigured services
will trigger a notice.
This was reported in FriendsOfSymfony/FOSCommentBundle#234
2012-07-14 13:04:03 +02:00
Christophe Coevoet
12bdec3cd2 Moved the NormalizationAwareInterface check to the ChainEncoder
This allows nesting a ChainEncoder inside another one without breaking
the check.
2012-07-14 12:15:12 +02:00
Christophe Coevoet
28e137c920 [Serializer] Added a ChainEncoder and a ChainDecoder
These classes contains the logic previously defined in the Serializer
itself to handle the choice of a serializer. This allows reusing it when
using only the encoding part of the component.
2012-07-14 12:15:07 +02:00
Bernhard Schussek
69e5e58629 [Form] Individual rows of CollectionType cannot be styled anymore for performance reasons 2012-07-14 12:10:29 +02:00
Fabien Potencier
cf41bf8776 merged branch hhamon/french_translation_messages (PR #4906)
Commits
-------

b3958af [Validator] [Resources] fixed french validator translated messages for the french locale.

Discussion
----------

[Validator] [Resources] fixed french validator translated messages for the french locale

Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: #4900
2012-07-14 11:53:10 +02:00
Hugo Hamon
b3958af35c [Validator] [Resources] fixed french validator translated messages for the french locale. 2012-07-14 11:14:40 +02:00
Fabien Potencier
4b2230da93 [WebProfilerBundle] injected Request object into the controller instead of getting it from the container 2012-07-14 10:09:51 +02:00
Fabien Potencier
5fb72144da merged branch jalliot/profiler-logs (PR #4902)
Commits
-------

77b4349 [WebProfiler] Improved logger panel

Discussion
----------

[WebProfiler] Improved logger panel

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

* Add missing priority levels from filter
* Display priority level in front of each log entry
* Add a yellow background for warnings and use the red one for errors and above (previously only errors)
* Display `No logs available for this priority.` when filter is too restrictive
2012-07-14 00:00:47 +02:00
Tobias Schultze
ffd8c1e773 [Form] add thrown exceptions to FormRegistryInterface 2012-07-14 00:14:36 +03:00
Jordan Alliot
77b434996e [WebProfiler] Improved logger panel 2012-07-13 22:51:18 +02:00
Fabien Potencier
b0d7d9e406 merged branch zachbadgett/frameworkbundle-session-file-handler-fix (PR #4901)
Commits
-------

23d8735 Added NativeFileSessionHandler to classes to compile .
12d6ae7 Removed FileSessionHandler from FrameworkExtension to stop compiling a file that does not exist.

Discussion
----------

[FrameworkBundle] Removed FileSessionHandler from FrameworkExtension to stop compiling a file that does not exist.

PR #4899 removed FileSessionHandler which caused a class not found error from FrameworkBundle after the cache was created. This PR will fix it.

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

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

by stof at 2012-07-13T19:12:51Z

you should add the NativeSessionHandler class in the list instead as it replaces it

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

by tystr at 2012-07-13T19:14:29Z

+1

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

by zachbadgett at 2012-07-13T19:15:55Z

Done
2012-07-13 21:31:17 +02:00
Fabien Potencier
a27aeda8f4 merged branch bschussek/performance (PR #4882)
Commits
-------

cd7835d [Form] Cached the form type hierarchy in order to improve performance
2ca753b [Form] Fixed choice list hashing in DoctrineType
2bf4d6c [Form] Fixed FormFactory not to set "data" option if not explicitely given
7149d26 [Form] Removed invalid PHPDoc text

Discussion
----------

[Form] WIP Improved performance of form building

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

This PR is work in progress and up for discussion. It increases the performance of FormFactory::createForm() on a specific, heavy-weight form from **0.848** to **0.580** seconds.

Before, the FormFactory had to traverse the hierarchy and calculate the default options of each FormType everytime a form was created of that type.

Now, FormTypes are wrapped within instances of a new class `ResolvedFormType`, which caches the parent type, the type's extensions and its default options.

The updated responsibilities: `FormFactory` is a registry and proxy for `ResolvedFormType` objects, `FormType` specifies how a form can be built on a specific layer of the type hierarchy (e.g. "form", or "date", etc.) and `ResolvedFormType` *does the actual building* across all layers of the hierarchy (by delegating to the parent type, which delegates to its parent type etc.).

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

by schmittjoh at 2012-07-12T18:25:40Z

Maybe ResolvedFormType

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

by jmather at 2012-07-13T02:56:38Z

I really like ResolvedFormType. That's the naming method I took for my tag parser that handes the same conceptual issue.

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

by axelarge at 2012-07-13T05:25:00Z

ResolvedFormType sounds very clear.
This change is great and I desperately hope to see more of this kind

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

by Baachi at 2012-07-13T06:41:26Z

Yes `ResolvedFormType` sounds good :) 👍

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

by fabpot at 2012-07-13T07:11:33Z

I like `ResolvedFormType` as well.

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

by henrikbjorn at 2012-07-13T07:46:48Z

👍 `ResolvedFormType` :shipit:

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

by stof at 2012-07-13T18:01:51Z

This looks good to me
2012-07-13 21:26:31 +02:00
Fabien Potencier
2dcc44897e raised the minimum version of PHP to 5.3.4 (closes #3856)
We've raised the minimum version of PHP because of a PHP
bug before 5.3.4:

https://bugs.php.net/bug.php?id=52083
https://bugs.php.net/bug.php?id=50027
2012-07-13 21:22:46 +02:00
Zach Badgett
23d87353a2 Added NativeFileSessionHandler to classes to compile . 2012-07-13 13:14:31 -06:00
Zach Badgett
12d6ae76a2 Removed FileSessionHandler from FrameworkExtension to stop compiling a file that does not exist. 2012-07-13 13:04:05 -06:00
Bernhard Schussek
cd7835d8d2 [Form] Cached the form type hierarchy in order to improve performance 2012-07-13 20:39:30 +02:00
Fabien Potencier
a798ff100c merged branch drak/nativestorage (PR #4899)
Commits
-------

a351362 [HttpFoundation] Add NativeSessionHandler tests
653821a [HttpFoundation] Remove FileSessionHandler
3456787 Partially revert "[HttpFoundation][Sessions] Refactored tests"
39813a0 Revert "[FrameworkBundle] Refactor session file handler service name and update changelogs"
fbee4cf Restore NativeFileSessionHandler

Discussion
----------

[Session] Restore NativeFileSessionStorage

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

This reverts the removal of the native file handler.
2012-07-13 20:34:02 +02:00
Drak
a351362f19 [HttpFoundation] Add NativeSessionHandler tests 2012-07-13 17:34:14 +01:00
Drak
653821a11b [HttpFoundation] Remove FileSessionHandler
This driver is inferior to native handling
2012-07-13 16:40:50 +01:00
Drak
345678786e Partially revert "[HttpFoundation][Sessions] Refactored tests"
This partially reverts commit 3c8cc0a1a0.
2012-07-13 16:40:43 +01:00
Fabien Potencier
7b0d100e02 merged 2.0 2012-07-13 16:05:38 +02:00
Drak
39813a0a05 Revert "[FrameworkBundle] Refactor session file handler service name and update changelogs"
This partially reverts commit 13a2c82f01.
2012-07-13 14:54:32 +01:00
Drak
fbee4cf700 Restore NativeFileSessionHandler
Partial revert "[HttpFoundation] Removed Native*Handler session save handler classes"

This partially reverts commit b2cc580be7.
2012-07-13 14:52:46 +01:00
Alexander
e97cd61a89 [DoctrineBridge] Fix arguments when registering event listeners on multiple connections
Fixes #4712
2012-07-13 15:19:24 +02:00
Alexander
0bf3c068d7 [DoctrineBridge] Failing testcase for event listeners and multiple connections 2012-07-13 15:05:25 +02:00
Bernhard Schussek
2ca753bc68 [Form] Fixed choice list hashing in DoctrineType 2012-07-13 14:48:51 +02:00
Rui Marinho
8a725f8f25 Updated Spanish translation 2012-07-13 11:51:36 +01:00
Fabien Potencier
498759a2e8 [HttpKernel] fixed HTTP exception headers in ExceptionHandler 2012-07-13 12:14:13 +02:00
Bernhard Schussek
2bf4d6cff4 [Form] Fixed FormFactory not to set "data" option if not explicitely given 2012-07-13 12:12:25 +02:00
Fabien Potencier
3f05e7047f ensured that an exception is always converted to an error response (and that we keep the HTTP status code and headers) 2012-07-13 11:55:51 +02:00
Fabien Potencier
46071f3238 [Security] made sure that we always replace the security access denied exception to an HTTP one 2012-07-13 11:36:57 +02:00
Fabien Potencier
7dc89013eb merged branch jfsimon/issue-4885 (PR #4891)
Commits
-------

3fef3c2 [Console] Fixed output formatter regex.
fea9d09 [Console] Added LG char escaping test.

Discussion
----------

Issue 4885

Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: #4885
2012-07-13 11:28:57 +02:00
Fabien Potencier
295860dfaf [HttpKernel] avoid hidding exceptions set in exception listeners (see the Security ExceptionListener for some examples) 2012-07-13 11:25:52 +02:00