Commit Graph

10832 Commits

Author SHA1 Message Date
modi
83269a46cb update zh_CN translations of Form Component 2012-08-06 09:36:49 +08:00
Fabien Potencier
20d2e5a1cf merged branch franmomu/master (PR #5183)
Commits
-------

3d5b1db [Validator] Updated Catalonian translations y fixed typos in Spanish

Discussion
----------

[Validator] Updated Catalonian translations and fixed typos in Spanish

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

by travisbot at 2012-08-05T10:34:55Z

This pull request [fails](http://travis-ci.org/symfony/symfony/builds/2039920) (merged 3d5b1dbf into c99f9d29).
2012-08-05 13:44:58 +02:00
Fran Moreno
3d5b1dbfff [Validator] Updated Catalonian translations y fixed typos in Spanish 2012-08-05 12:26:28 +02:00
Fabien Potencier
c99f9d29cd fixed merge 2012-08-04 12:08:20 +02:00
Fabien Potencier
d6374ae531 bumped Symfony version to 2.1.0-DEV 2012-08-04 12:04:35 +02:00
Fabien Potencier
443e77ddec updated VERSION for 2.1.0-RC1 2012-08-04 11:32:21 +02:00
Fabien Potencier
7a75a1160b merged branch EvanK/master (PR #5132)
Commits
-------

aa890ae validateOptionTypes checking existence of key rather than value
c6a9638 OptionsResolver#validateOptionTypes should check if option value exists before checking its type; added corresponding test

Discussion
----------

[OptionsResolver] validateOptionTypes raises error for optional, nonexistant option values

The [`OptionsResolver#validateOptionTypes`](https://github.com/symfony/OptionsResolver/blob/master/OptionsResolver.php#L315) method should check if a given option value exists before trying to test its type:

```php
<?php
// Two optional 'one' and 'two' options that, if they exist, must be a string and int respectively
$resolver = new OptionsResolver();
$resolver->setOptional(array('one', 'two'))->setAllowedTypes(array('one' => 'string', 'two' => 'int'));

// Correctly fails as wrong type
$resolver->resolve(array('one' => 1, 'two' => 'alpha'));

// Correctly succeeds
$resolver->resolve(array('one' => 'alpha', 'two' => 1));

// Raises error "Undefined index: two", see OptionsResolver.php line 315
$resolver->resolve(array('one' => 'alpha'));
```

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

by travisbot at 2012-08-01T01:46:50Z

This pull request [passes](http://travis-ci.org/symfony/symfony/builds/2006049) (merged c6a9638a into b1618d21).

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

by ericclemmons at 2012-08-03T05:15:27Z

I hope this makes it in for the 2.1 release.  We have several types attempting to take advantage of the `OptionsResolver` component and want to help resolve this.

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

by stof at 2012-08-03T07:30:44Z

👍

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

by travisbot at 2012-08-03T17:25:12Z

This pull request [passes](http://travis-ci.org/symfony/symfony/builds/2030053) (merged aa890aed into b1618d21).
2012-08-04 11:23:52 +02:00
Fabien Potencier
ed5153d810 merged branch franmomu/patch-2 (PR #5177)
Commits
-------

981da1a [Validator] Updated Spanish translations

Discussion
----------

[Validator] Updated Spanish translations

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

by travisbot at 2012-08-03T23:06:26Z

This pull request [passes](http://travis-ci.org/symfony/symfony/builds/2032706) (merged 981da1a9 into be41ca35).
2012-08-04 11:19:37 +02:00
Fabien Potencier
aeaa69ae43 [HttpFoundation] fixed tests (refs #5175) 2012-08-04 11:18:38 +02:00
Fabien Potencier
3f51bc0a3d [HttpFoundation] fixed typo (refs #5175) 2012-08-04 11:17:35 +02:00
Fabien Potencier
532334d23d merged branch chx/master (PR #5175)
Commits
-------

b00ea41 StreamedResponse always sends a HTTP 1.1 response

Discussion
----------

StreamedResponse always sends a HTTP 1.1 response

SERVER_PROTOCOL is "Name and revision of the information protocol via which the page was requested; i.e. 'HTTP/1.0'". The condition was for 1.0 which is wrong.

Earlier I filed #5173

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

by travisbot at 2012-08-03T18:33:45Z

This pull request [fails](http://travis-ci.org/symfony/symfony/builds/2030496) (merged b00ea417 into be41ca35).

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

by chx at 2012-08-03T18:36:58Z

Seems to me that the Travis fails have absolutely nothing to do with my patch.
2012-08-04 11:17:16 +02:00
Fran Moreno
981da1a908 [Validator] Updated Spanish translations 2012-08-04 01:58:06 +03:00
chx
b00ea41769 StreamedResponse always sends a HTTP 1.1 response
SERVER_PROTOCOL is "Name and revision of the information protocol via which the page was requested; i.e. 'HTTP/1.0'"
2012-08-03 21:27:14 +03:00
Evan Kaufman
aa890aedfc validateOptionTypes checking existence of key rather than value 2012-08-03 12:17:58 -05:00
Fabien Potencier
be41ca353b merged branch cs278/master (PR #5172)
Commits
-------

d1aae0b [Form] Fix UnexpectedTypeException from HttpFoundation extension

Discussion
----------

[Form] Fix UnexpectedTypeException from HttpFoundation extension

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

Fixes exception thrown by the `AbstractExtension` because the wrong method has been implemented.

```
Uncaught exception 'Symfony\\Component\\Form\\Exception\\UnexpectedTypeException' with message 'Expected argument of type "Symfony\\Component\\Form\\FormTypeInterface", "Symfony\\Component\\Form\\Extension\\HttpFoundation\\Type\\FormTypeHttpFoundationExtension" given' in vendor/symfony/form/Symfony/Component/Form/AbstractExtension.php:153
```

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

by stof at 2012-08-03T12:36:55Z

👍
2012-08-03 14:48:44 +02:00
Fabien Potencier
c5346610f3 Merge branch '2.0'
* 2.0:
  Fixes incorrect class used in src/Symfony/Bundle/FrameworkBundle/Console/Application.php
  [FrameworkBundle] added test for fix broken command registration
  corrected phpdoc
2012-08-03 14:44:30 +02:00
Fabien Potencier
89dce2df51 merged branch SamsonIT/fix_broken_command_registration (PR #5169)
Commits
-------

55a0b34 Fixes incorrect class used in src/Symfony/Bundle/FrameworkBundle/Console/Application.php
79c547f [FrameworkBundle] added test for fix broken command registration

Discussion
----------

[FrameworkBundle] fix broken command registration

fixed #5168, #5166

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

by travisbot at 2012-08-03T11:35:29Z

This pull request [passes](http://travis-ci.org/symfony/symfony/builds/2027699) (merged 39e964b8 into fee3f4e1).

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

by travisbot at 2012-08-03T11:45:14Z

This pull request [passes](http://travis-ci.org/symfony/symfony/builds/2027761) (merged 55a0b347 into fee3f4e1).

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

by xeross at 2012-08-03T11:45:45Z

Duplicate of #5166

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

by Burgov at 2012-08-03T11:47:54Z

@xeross that PR was opened on master instead of 2.0

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

by xeross at 2012-08-03T11:48:49Z

@Burgov Ah sorry, I got confused and thought this was another dupe
2012-08-03 14:43:49 +02:00
Fabien Potencier
982545350b merged branch lsmith77/container_builder_cosmetics (PR #5165)
Commits
-------

4563397 corrected phpdoc

Discussion
----------

corrected phpdoc

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

by travisbot at 2012-08-03T09:37:07Z

This pull request [passes](http://travis-ci.org/symfony/symfony/builds/2026993) (merged 4563397c into fee3f4e1).
2012-08-03 14:40:59 +02:00
Chris Smith
d1aae0b106 [Form] Fix UnexpectedTypeException from HttpFoundation extension 2012-08-03 13:20:47 +01:00
smokeybear87
55a0b347a0 Fixes incorrect class used in src/Symfony/Bundle/FrameworkBundle/Console/Application.php
Issue must be related to commit 7a5f614240 (merged 2.0), specifically this file src/Symfony/Bundle/FrameworkBundle/Console/Application.php, lines 86-88. 

Presumably to do "instanceof Bundle" correct class has to be imported at the top of the file:

instead of 
use Symfony\Component\HttpKernel\Bundle;

this should be
use Symfony\Component\HttpKernel\Bundle\Bundle;
Conflicts:

	src/Symfony/Bundle/FrameworkBundle/Console/Application.php
2012-08-03 13:33:57 +02:00
Bart van den Burg
79c547f09c [FrameworkBundle] added test for fix broken command registration 2012-08-03 13:33:31 +02:00
lsmith77
4563397c0a corrected phpdoc 2012-08-03 11:27:08 +02:00
Fabien Potencier
48e384b6e0 merged branch vicb/doctrine_logger_2.1 (PR #5162)
Commits
-------

6097c80 [DoctrineBridge] Fix log of non utf8 data

Discussion
----------

[DoctrineBridge] Fix log of non utf8 data

relates to #5139 (fix #5115 for 2.1)

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

by travisbot at 2012-08-03T08:34:14Z

This pull request [passes](http://travis-ci.org/symfony/symfony/builds/2026546) (merged 6097c804 into 6f32078b).
2012-08-03 11:14:28 +02:00
Fabien Potencier
7a5f614240 merged 2.0 2012-08-03 11:11:11 +02:00
Fabien Potencier
fee3f4e1ef merged branch vicb/doctrine_logger (PR #5139)
Commits
-------

a0709fc [DoctrineBridge] Fix log of non utf8 data

Discussion
----------

Doctrine logger - fix logging of binary data

fix #5115

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

by travisbot at 2012-08-01T11:21:07Z

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

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

by stof at 2012-08-01T11:54:45Z

I see a way to fix it in a far better way: instead of json_encoding the parameters and appending them to the SQL, we could pass them as context to the logger (the optional second argument) as Monolog already handles normalizing the context (and in a better way silencing the error).
Btw, this would also make the log message better for rich logger as they would receive the array (for instance, the FirephpHandler is able to send the context as an array instead of a string as firebug is able to dump arrays)

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

by vicb at 2012-08-01T12:19:06Z

@stof you're right that would be much better. What about keeping this fix for 2.0 and use your suggestion for 2.1 (as the public `log` method prototype would change (to take the context as argument) ?

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

by stof at 2012-08-01T12:21:09Z

@vicb as the method is public, it need to be done in 2.1 only indeed. The next question being "why is it public ?" :)

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

by fabpot at 2012-08-03T07:47:39Z

So, what's the next step?

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

by vicb at 2012-08-03T07:48:38Z

I think this should be merged in 2.0 and then 2.1 should be updated with the suggestion from @stof

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

by fabpot at 2012-08-03T07:54:16Z

Can you provide a PR for 2.1 so that I merge both at the same time?
2012-08-03 10:46:13 +02:00
Fabien Potencier
089feb7c96 merged branch lsmith77/container_builder_cosmetics (PR #5163)
Commits
-------

3605c54 removed unused private property
d4a78a2 fix phpdoc statement of getAlias()

Discussion
----------

Container builder cosmetics

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

by travisbot at 2012-08-03T08:39:00Z

This pull request [passes](http://travis-ci.org/symfony/symfony/builds/2026569) (merged 3605c54f into 13c60bde).
2012-08-03 10:44:24 +02:00
Fabien Potencier
6b94407e1c merged branch dlsniper/php-engine-escape-cache (PR #5117)
Commits
-------

22cb817 Caching variables for the PHP templating engine

Discussion
----------

[Templating] PHP templating engine speed-ups

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

This PR should improve the speed for rendering the form present here: https://github.com/dlsniper/symfony-standard . On my computer, Ubuntu 12.04 Apache 2.2.22 + mod_php 5.3.10 default packages from Ubuntu on a core i7 I get about 30-40ms improvement / request with the first commit and with the second one I get a further smaller boost and also a small memory usage decrease.

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

by dlsniper at 2012-07-31T06:18:54Z

ping @bschussek This should help a bit more on the effort for optimizing the example provided for the Forms component.

If there's another example of complex form(s) let me know so that I can have a look on them as well. Thanks!

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

by travisbot at 2012-07-31T19:55:03Z

This pull request [passes](http://travis-ci.org/symfony/symfony/builds/2003907) (merged 240152b9 into a172a812).

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

by dlsniper at 2012-08-02T07:41:03Z

@fabpot what do you think about this? or anyone else for that matter?

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

by travisbot at 2012-08-02T12:55:54Z

This pull request [passes](http://travis-ci.org/symfony/symfony/builds/2018613) (merged 5e773e79 into a172a812).

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

by fabpot at 2012-08-03T07:42:31Z

Can you squash your commits?

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

by dlsniper at 2012-08-03T08:32:05Z

@fabpot Done

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

by travisbot at 2012-08-03T08:40:46Z

This pull request [passes](http://travis-ci.org/symfony/symfony/builds/2026559) (merged 22cb8173 into 6f32078b).
2012-08-03 10:43:22 +02:00
Florin Patan
22cb8173b5 Caching variables for the PHP templating engine 2012-08-03 11:28:29 +03:00
lsmith77
3605c54f9d removed unused private property 2012-08-03 10:28:23 +02:00
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
Fabien Potencier
bb57e54320 merged branch web-dev/bundle-interface-command-fatal-error (PR #5133)
Commits
-------

30bcb57 Added a test case to demonstrate the fatal error occuring when a Bundle implementing BundleInterface only is registered in the kernel.

Discussion
----------

Fatal error in FrameworkBundle console application

A fatal error is generated in the `FrameworkBundle` console application when a bundle is added implementing [`BundleInterface`](https://github.com/symfony/symfony/blob/master/src/Symfony/Component/HttpKernel/Bundle/BundleInterface.php)

This is because the method `registerCommands` does not exist on this interface and is instead only defined on the concrete [`Bundle`](https://github.com/symfony/symfony/blob/master/src/Symfony/Component/HttpKernel/Bundle/Bundle.php#L173) implementation.

The workaround for this issue is simple - implement an empty method for `registerCommands` in the bundle implementation so that the fatal error is not triggered.

However this issue should probably be fixed by either restricting bundles to the Bundle class or expanding the `BundleInterface` to include the `registerCommands` method signature. Both of these fixes will introduce a BC break into the API so I would suggest creating a fix for 2.0 which includes method detection in the `registerCommands` method of the [`Console\Application`](https://github.com/symfony/symfony/blob/master/src/Symfony/Bundle/FrameworkBundle/Console/Application.php#L80) class.

I'm happy to submit the fix for this - however I would like some direction from the SF2 dev team as to which way they would like to resolve this.

The PR currently only contains a unit test that proves this behaviour.

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

by travisbot at 2012-08-01T02:42:55Z

This pull request [fails](http://travis-ci.org/symfony/symfony/builds/2006350) (merged 30bcb572 into 1da896dc).

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

by henrikbjorn at 2012-08-01T05:50:16Z

I am thinking a instanceof check might be the most reasonable in this case. But in master it should proberly be fixed by adding the method to the interface.

/cc @stof any comments if that is to be done?

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

by stof at 2012-08-01T08:53:02Z

yeah, for 2.0, we cannot change the interface.
2012-08-03 10:18:29 +02:00
Fabien Potencier
f5d2187143 merged branch gajdaw/md_format_fix (PR #5160)
Commits
-------

6b0dcbb MD format fix

Discussion
----------

Md format fix

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

Small format fixes in CHANGELOG-2.0.md.

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

by travisbot at 2012-08-03T06:23:27Z

This pull request [passes](http://travis-ci.org/symfony/symfony/builds/2025980) (merged 6b0dcbb7 into 1da896dc).
2012-08-03 09:30:11 +02:00
Fabien Potencier
6f32078b1a merged branch richardmiller/adding_example_to_upgrade_info (PR #5153)
Commits
-------

2c3a7bf Added before/after examples of change in registering security factories to upgrade info.

Discussion
----------

Added before/after examples of change in registering security factories ...

...to upgrade info.
2012-08-03 09:29:00 +02:00
Włodzimierz Gajda
6b0dcbb730 MD format fix 2012-08-03 08:13:46 +02:00
Richard Miller
2c3a7bf57b Added before/after examples of change in registering security factories to upgrade info. 2012-08-02 12:39:17 +01: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
Fabien Potencier
5b9b995b2c merged branch bamarni/patch-3 (PR #5125)
Commits
-------

f84f5fd fixed typo

Discussion
----------

fixed typo
2012-07-31 15:58:01 +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