Commit Graph

9394 Commits

Author SHA1 Message Date
Jordi Boggiano
832f8dd4fe Add support for Monolog 1.2.0 2012-08-18 19:58:03 +02:00
Fabien Potencier
7fe18d13a0 merged branch mtdowling/event_dispatcher_add_iterator (PR #5268)
Commits
-------

0ad00f8 [EventDispatcher] Adding IteratorAggregate to GenericEvent

Discussion
----------

[EventDispatcher] Adding IteratorAggregate to GenericEvent

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

by drak at 2012-08-16T07:43:29Z

What is the use case for this that it should be part of the Generic event?

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

by mtdowling at 2012-08-16T17:12:28Z

This allows for the GenericEvent to be even more generic. Now listeners don't need to know an exact key from the arguments, but rather can iterate over the arguments to find what they are looking for. This makes the GenericEvent more like an array.

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

by mtdowling at 2012-08-17T19:31:04Z

How would this be a nasty break? It's just giving the GenericEvent more capabilities with IteratorAggregate.

This is a completely separate PR from the one that flipped the constructor args.

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

by schmittjoh at 2012-08-17T19:34:47Z

Why are you not just doing ``foreach ($event->getArguments() as $arg) { /** ... */ }``?

If you just have ``foreach ($event)``, to me at least it would not be so clear what we are actually iterating over.

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

by mtdowling at 2012-08-17T19:39:23Z

This class already has ArrayAccess. If you're already using this class like an array, then I think you should expect to be able to iterate it like an array. I'm just finishing that concept off by implementing IteratorAggregate.

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

by schmittjoh at 2012-08-17T19:47:43Z

Indeed, if we already have ArrayAccess which we probably don't want to remove again, then that seems reasonable.
2012-08-18 10:28:12 +02:00
Fabien Potencier
1f37191938 merged branch Marmelatze/var_dump (PR #5291)
Commits
-------

9c20634 fixes pre for var_dump with xdebug

Discussion
----------

Displaying var_dump with xdebug in exceptions

When debugging code I often use `var_dump` to quickly look into variables. Since 2.1 alle output generated by `var_dump` is displayed in one line. http://screencast.com/t/11LuIlIdHsvP
It seems to be no problem for small objects, but it becomes a real pain when displaying huge arrays or objects.

This is caused by the changed word-wrapping for the pre tag introduced in #3827

With fix: http://screencast.com/t/GdA3dkpWxU

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

by dlsniper at 2012-08-17T17:22:38Z

👍
2012-08-18 10:25:33 +02:00
Fabien Potencier
df889fb28b merged branch drak/nullhandler (PR #5290)
Commits
-------

8e11aaa [FrameworkBundle] Allow to set null for the handler in NativeSessionStorage

Discussion
----------

[FrameworkBundle] Allow to set null for the handler in NativeSessionStorage

Bug fix: no
Feature addition: yes (ok for RC)
Backwards compatibility break: yes
Symfony2 tests pass: yes
Fixes the following tickets: 5267
Todo: ~
License of the code: MIT
Documentation PR: ~

Refs #5267

Adds the following configuration

```
session:
        handler_id: ~
```

Which allows the configuration of the session not to use any save handler and therefor just use whatever save_handler is set in `php.ini`

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

by dlsniper at 2012-08-17T17:24:37Z

👍
2012-08-18 10:24:48 +02:00
Michael Piecko
58ebd1bb83 [Form] Fixed error bubbling from DateTime widget - Issue #5270 2012-08-17 19:39:57 +02:00
Florian Pfitzer
9c20634297 fixes pre for var_dump with xdebug 2012-08-17 18:39:39 +02:00
Drak
8e11aaa2f2 [FrameworkBundle] Allow to set null for the handler in NativeSessionStorage 2012-08-17 17:38:35 +01:00
Bilal Amarni
bd9319bd6e added a missing phpdoc param 2012-08-17 13:01:11 +03:00
Fabien Potencier
d3625b0c2b merged branch Tobion/headerbag (PR #5282)
Commits
-------

ccb6dad [HttpFoundation] fixed undefined offset for assoc arrays in HeaderBag

Discussion
----------

[HttpFoundation] fixed undefined offset for assoc arrays in HeaderBag

`get` is assuming the headers are zero-indexed. So something like this would otherwise create a php warning.
```
$bag->set('foo', array('bad-assoc-index' => 'value'));
$this->assertSame('value', $bag->get('foo'));
```
2012-08-17 10:18:18 +02:00
Fabien Potencier
71d2301726 merged branch Tobion/patch-3 (PR #5276)
Commits
-------

bdaa877 [HttpFoundation] fix #5271 (duplicated header in JsonResponse)

Discussion
----------

fix JsonResponse: duplicate header

fix #5271

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

by Tobion at 2012-08-16T16:50:04Z

Will look into the failing test later.

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

by Tobion at 2012-08-16T23:55:45Z

Finished.
2012-08-17 10:16:33 +02:00
Tobias Schultze
ccb6dad09a [HttpFoundation] fixed undefined offset for assoc arrays in HeaderBag 2012-08-17 02:19:35 +02:00
Tobias Schultze
bdaa8774af [HttpFoundation] fix #5271 (duplicated header in JsonResponse) 2012-08-17 01:52:46 +02:00
Michael Piecko
8ea1607991 Update src/Symfony/Component/Form/Extension/Core/Type/DateTimeType.php 2012-08-16 21:12:31 +03:00
Fabien Potencier
6d740314c5 merged branch bschussek/issue5144 (PR #5278)
Commits
-------

0add23f [Form] Reintroduced the option "invalid_message_parameters"

Discussion
----------

[Form] Reintroduced the option "invalid_message_parameters"

Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: #5144
Todo: -
2012-08-16 20:05:46 +02:00
Bernhard Schussek
0add23f8d6 [Form] Reintroduced the option "invalid_message_parameters" 2012-08-16 19:22:27 +02:00
Bernhard Schussek
3ad3876ff8 [Form] Fixed support for preferred choices in "entity" type 2012-08-16 18:19:53 +02:00
Michael Dowling
0ad00f8a56 [EventDispatcher] Adding IteratorAggregate to GenericEvent 2012-08-15 14:38:32 -07:00
Fabien Potencier
50df1a72aa merged branch guilhermeblanco/redis_support (PR #5224)
Commits
-------

493aa12 Added support to redis, wincache and zend data cache.

Discussion
----------

Added support to redis, wincache and zend data cache.

These three drivers were missing support on DoctrineBundle.

DoctrineBundle PR https://github.com/doctrine/DoctrineBundle/pull/99 must be merged first

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

by stof at 2012-08-09T20:35:21Z

This looks good to me
2012-08-15 19:23:23 +02:00
Fabien Potencier
d4d368f970 merged branch gimler/patch-3 (PR #5256)
Commits
-------

a7b4573 add format to exception message

Discussion
----------

add format to exception message
2012-08-15 19:22:38 +02:00
Fabien Potencier
82902e6ecc merged branch myurasov/patch-1 (PR #5261)
Commits
-------

ac0fb48 0x02 -> \MongoBinData::BYTE_ARRAY
70a64bd MongoBinData constructor now require "type" parameter

Discussion
----------

MongoBinData constructor now requires "type" parameter

From mongo driver version 1.2.11 E_DEPRECATED is emitted when the 2nd argument (type) is not used for MongoBinData constructor. At the moment the default value is 0x02 ("byte array").

See: http://php.net/manual/en/mongobindata.construct.php
2012-08-15 19:21:07 +02:00
Julien 'ruian' Galenski
524081f4cf fix CS into Finder
fix CS into Finder
2012-08-15 13:32:42 +03:00
Mikhail Yurasov
ac0fb48496 0x02 -> \MongoBinData::BYTE_ARRAY 2012-08-14 23:38:12 -07:00
Mikhail Yurasov
70a64bd7cf MongoBinData constructor now require "type" parameter
From mongo driver version 1.2.11 E_DEPRECATED is emitted when the 2nd argument (type) is not used for MongoBinData constructor. At the moment the default value is 0x02 ("byte array").

See: http://php.net/manual/en/mongobindata.construct.php
2012-08-14 10:56:22 -07:00
Fabien Potencier
826f5122e9 Revert "merged branch guilhermeblanco/patch-6 (PR #4456)"
This reverts commit 6c527b6282, reversing
changes made to 223d187abc.
2012-08-14 19:34:30 +02:00
Gordon Franke
a7b4573a69 add format to exception message 2012-08-14 16:38:05 +02:00
Fabien Potencier
fa4f9f58ff merged branch daFish/fixes/issue5108 (PR #5247)
Commits
-------

57694aa Removed MySQL-exclusive usage of unsigned integer from table creation

Discussion
----------

[Security] Removed MySQL-exclusive usage of unsigned integer from table creation

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

This patch removes the setting of unsigned integer fields which are MySQL-only.

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

by fabpot at 2012-08-13T12:25:23Z

@beberlei Does it look good?

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

by travisbot at 2012-08-13T12:30:27Z

This pull request [passes](http://travis-ci.org/symfony/symfony/builds/2107738) (merged 57694aaa into 31536c36).

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

by lsmith77 at 2012-08-13T20:04:20Z

indeed afaik unsigned isnt part of the sql standard. in other RDBMS you need to use a constraint if you want to prevent negative values and of course there is no way to then also get the additional values per bit that you get with MySQL, but so it goes. that being said .. i dont know how Doctrine schema handles unsigned for other RDBMS .. ie if it just emulates them by trying to double the size with a constraint.

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

by beberlei at 2012-08-13T20:10:44Z

Looks good.

Doctrine ignores the 'unsigned' => true for all others vendors.
2012-08-13 22:15:47 +02:00
Grayson Koonce
b7caf374bf Adding more specific debug bar reset CSS.
This prevents frameworks like Foundation from getting past the reset.

Fixes #5250
2012-08-13 12:02:28 -07:00
Christophe L
47b8538edd [Filesystem] missing realpath breaking FilesystemTest class on Windows (one line of code change) 2012-08-13 20:33:11 +04:00
daFish
57694aaa94 Removed MySQL-exclusive usage of unsigned integer from table creation 2012-08-13 14:02:41 +02:00
Massimiliano Arione
f248e0c33d Update src/Symfony/Component/Validator/Resources/translations/validators.it.xlf
fixed typo in Italian translation
2012-08-13 14:18:03 +03:00
Tobias Schultze
9e5d5a4763 [Form] fix static method call 2012-08-11 00:52:54 +03:00
Fabien Potencier
31536c36ec merged 2.0 2012-08-10 13:48:23 +02:00
Fabien Potencier
ee572b34cf merged branch hidenorigoto/fix-di-phpdumper (PR #5194)
Commits
-------

1a4a4ee [DependencyInjection] Fixed a frozen constructor of a container with no parameters
2a124bc [DependencyInjection] Added a test for a frozen constructor of a container with no parameters

Discussion
----------

[DependencyInjection] Fix PHP Dumper for a constructor of a frozen container with no parameters

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

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

by travisbot at 2012-08-06T16:51:20Z

This pull request [passes](http://travis-ci.org/symfony/symfony/builds/2049206) (merged 1a4a4ee9 into 3d32a0bc).
2012-08-10 12:39:41 +02:00
Fabien Potencier
268b618bfe merged branch lyrixx/console-typo (PR #5208)
Commits
-------

039264d [Console] Fixed tests about message exception when command is not available
a4d2d31 [Console] Added tests for message exception when command is not available

Discussion
----------

[Console] Fixed message exception when command is not avaible

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

Fixed singular / plural
`Did you mean this?` VS `Did you mean one of these`

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

by travisbot at 2012-08-07T14:40:55Z

This pull request [fails](http://travis-ci.org/symfony/symfony/builds/2057647) (merged 039264d2 into b91a4a83).

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

by lyrixx at 2012-08-07T15:11:47Z

@travisbot You failed, not me !
2012-08-10 12:37:27 +02:00
Fabien Potencier
1122be7d27 merged branch bamarni/patch-4 (PR #5207)
Commits
-------

5ad75c7 updated method name in a comment

Discussion
----------

updated method name in a comment

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

by travisbot at 2012-08-07T14:35:39Z

This pull request [passes](http://travis-ci.org/symfony/symfony/builds/2057604) (merged 5ad75c71 into b91a4a83).
2012-08-10 12:37:02 +02:00
Fabien Potencier
1c314677d6 merged branch drak/nativefiletest (PR #5230)
Commits
-------

fa93324 [HttpFoundation] Fixed test under Windows environment

Discussion
----------

[HttpFoundation] Fixed test under Windows environment

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

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

by travisbot at 2012-08-10T09:54:20Z

This pull request [passes](http://travis-ci.org/symfony/symfony/builds/2084750) (merged fa933247 into dd9afddf).
2012-08-10 12:32:50 +02:00
Drak
fa93324791 [HttpFoundation] Fixed test under Windows environment 2012-08-10 10:43:07 +01:00
Guilherme Blanco
493aa12f99 Added support to redis, wincache and zend data cache. 2012-08-09 15:02:27 -04:00
Fabien Potencier
ef2c5bc18a merged branch drak/session_clean (PR #5211)
Commits
-------

22be499 [HttpFoundation][Session] Cleaned up constructor invokation

Discussion
----------

[HttpFoundation][Session] Cleaned up constructor invokation

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

This simply cleans up a mismatch between the class instantiation and the actual class constructor. Evidently something left over from the various iterations.

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

by travisbot at 2012-08-07T19:16:14Z

This pull request [passes](http://travis-ci.org/symfony/symfony/builds/2060028) (merged 22be4993 into 7dbadbf2).

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

by drak at 2012-08-09T08:25:43Z

ping @fabpot
2012-08-09 17:28:16 +02:00
Florin Patan
0677ed77b2 [Validator] Updated Romanian translations 2012-08-09 00:33:58 +03:00
Drak
22be49932f [HttpFoundation][Session] Cleaned up constructor invokation 2012-08-07 19:53:41 +01:00
Kris Wallsmith
c51fc105f4 avoid fatal error on invalid session 2012-08-07 14:21:04 -04:00
Eriksen Costa
33105e08d7 [Locale] added more information to the README.md regarding the need to build the ICU data when the intl extension ICU data version mismatch the one shipped with Symfony 2012-08-07 12:17:03 -03:00
Eriksen Costa
3191c704a1 [Validator] fixed tests, ICU 4.4 (Travis version) does not have the "my" locale 2012-08-07 12:17:03 -03:00
Eriksen Costa
d7b6bb32e6 [Locale] updated README.md 2012-08-07 12:17:03 -03:00
Eriksen Costa
6456361878 [Locale] added note about ICU data building: use the same PHP intl/ICU version as the desired version to build 2012-08-07 12:17:03 -03:00
Eriksen Costa
025f972973 [Locale] renamed function 2012-08-07 12:17:02 -03:00
Eriksen Costa
8da99ca67a [Locale] updated CHANGELOG.md 2012-08-07 12:17:02 -03:00
Eriksen Costa
d909360942 [Locale] don't create a "current" directory anymore, uses only the ICU version as the name of the data directory 2012-08-07 12:17:02 -03:00
Eriksen Costa
3f2b4bf344 [Locale] changed build data script name 2012-08-07 12:17:02 -03:00
Eriksen Costa
61e353942e [Form][Locale] updated minimum ICU version to 4.0 2012-08-07 12:17:01 -03:00
Eriksen Costa
0d442c7653 [Locale] as of ICU 4.8+, slash ("/") and dash ("-") are interchangeable, you can use any of them in a date/time pattern 2012-08-07 12:17:01 -03:00
Eriksen Costa
90d6dc3791 [Locale] fixed tests 2012-08-07 12:17:00 -03:00
Eriksen Costa
5fd4eb1c3a [Locale] updated ICU data paths 2012-08-07 12:17:00 -03:00
Eriksen Costa
64ccee7f98 [Locale] updated ICU data 2012-08-07 12:16:59 -03:00
Eriksen Costa
0d0a8d4649 [Locale] updated script to generate separated data directories for different ICU releases 2012-08-07 12:16:57 -03:00
Grégoire Pineau
039264d2d2 [Console] Fixed tests about message exception when command is not available 2012-08-07 16:24:01 +02:00
Grégoire Pineau
a4d2d31a9d [Console] Added tests for message exception when command is not available
These tests fail
2012-08-07 16:24:01 +02:00
Bilal Amarni
5ad75c71f3 updated method name in a comment 2012-08-07 17:22:46 +03:00
Fabien Potencier
b91a4a8368 merged branch sun/yaml-indent (PR #5157)
Commits
-------

3e1a1ab Force the value of Dumper::setIndentation($num) to be of type integer.
5be7237 Added Yaml\Dumper::setIndentation() method to allow a custom indentation level of nested nodes.

Discussion
----------

[Yaml] Allow custom indentation level for nested nodes

YAML does not specify an absolute indentation level, but a consistent indentation of nested nodes only: http://yaml.org/spec/current.html#indentation%20space/

Projects that are generally using 2 spaces for indentation should be able to retain consistency with their coding standards by supplying a custom value for the new $indent parameter for Yaml::dump() and Dumper::dump().

The new parameter is a backwards-compatible API addition and defaults to the previous default of 4 (which was changed from 2 via PR #2242 only recently).

The old $indent parameter is renamed to $level, and remains to be used internally only.

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

by travisbot at 2012-08-03T00:24:22Z

This pull request [fails](http://travis-ci.org/symfony/symfony/builds/2024289) (merged 56331202 into b1618d21).

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

by travisbot at 2012-08-03T00:29:02Z

This pull request [fails](http://travis-ci.org/symfony/symfony/builds/2024315) (merged eeae28a4 into b1618d21).

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

by travisbot at 2012-08-03T02:41:42Z

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

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

by fabpot at 2012-08-03T07:53:50Z

This is indeed a BC break as the method signature changed in a non-BC way.

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

by fabpot at 2012-08-03T08:35:51Z

I think I would prefer to have a static method to be able to change the number of spaces to use on a global basis. It makes more sense and would prevent the BC break. What do you think?

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

by sun at 2012-08-03T13:23:23Z

Thanks for your feedback! — Took some time to think through the static proposal.  Here's what I think:

1. The call from DependencyInjection\Dumper\YamlDumper truly was a unexpected/nasty surprise for me.  That is, because it passes a parameter to Yaml\Dumper that is documented for internal use only, and the surrounding YamlDumper code generally hard-codes lots of assumptions of where exactly the nodes/collections will be output in the dumped YAML structure.  (I think that code can be simplified, cleaned up, and made faster at the same time (hence the todo), but indeed, that probably belongs into a separate issue.)
1. The essential problem with a static is closely bound to that though; a static property value for the indentation would "stick" and thus hi-jack the DependencyInjection\Dumper\YamlDumper, as it hard-codes and thus expects 4 spaces (contrary to any custom indentation).
1. Most code uses Yaml\Yaml as utility/helper service directly, so there'd be no clean way to prime the static with a custom value, aside from subclassing the entire thing - in which case this entire issue would sorta become moot, because at the point you're subclassing, you can as well go the extra mile and replace the entire Yaml\Dumper::dump() to implant the custom indentation level...
1. Another option would be to use a non-static Yaml\Dumper::$indent property, supplied through the constructor; i.e.:

        public function __construct($indent = 4)

  ...or alternatively, ::setIndentation(). Essentially requiring people to use and instantiate Yaml\Dumper directly, if they want to use a custom indentation.
1. Though in the end, I don't want to sound pedantic, but I *do* wonder a bit about the exact extent of the `@api` tags, as well as `@param`s that are explicitly documented as "internal use only"... :)  That is, because only Yaml\Yaml is tagged with `@api`, but nothing in Yaml\Dumper.  The same sorta applies to DependencyInjection\Dumper\YamlDumper::dump(), which is tagged with `@api`, but the :.addService() method being adjusted accordingly here is not.  So essentially, when taking those tags (plus the param's description) seriously and in a nitpicky way, then there is no BC break, since no one should rely on their exact implementation... ;)  (I perfectly realize that this is a long shot :))

So... depending on the final stance on the last point, I'd either move forward with the current proposal in this PR.  Otherwise, I'd suggest the non-static property on Yaml\Dumper - in which case we'd likely try to swap out the static Symfony\Component\Yaml\Yaml helper with a Drupal\Component\Yaml\Yaml in order to always instantiate the dumper with the custom indentation.  What do you think?

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

by sun at 2012-08-04T22:57:21Z

Alright.  While I believe I made some good points in my last comment, I've taken the fully backwards-compatible path:

- added the new $indent parameter only to Yaml::dump()
- added a new Dumper::$intendation property and Dumper::setIndentation() method, to control the indentation level within the scope of a single Dumper instance only.

Do you think this is acceptible? :)

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

by travisbot at 2012-08-05T06:16:22Z

This pull request [fails](http://travis-ci.org/symfony/symfony/builds/2039120) (merged 5be7237b into c99f9d29).

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

by travisbot at 2012-08-07T07:51:04Z

This pull request [fails](http://travis-ci.org/symfony/symfony/builds/2055164) (merged 3e1a1abd into c99f9d29).

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

by sun at 2012-08-07T07:53:18Z

Only one environment failed, and the [test failure](http://travis-ci.org/#!/symfony/symfony/jobs/2055165/L203) seems unrelated to this PR.
2012-08-07 10:09:45 +02:00
Fabien Potencier
13454efe30 merged branch jfsimon/issue-5196 (PR #5197)
Commits
-------

c2207da [Console] Removed unused phpunit annotation.
c0c61da [Console] Added current style appliance for all styled text.
696a653 [Console] Removed text transformation for empty styles.
c7e324a [Console] Added test for non style tag formatting.

Discussion
----------

[Console] Non style tags dont disturb formatting anymore

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

Fixes issue #5196.

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

by travisbot at 2012-08-06T19:35:20Z

This pull request [passes](http://travis-ci.org/symfony/symfony/builds/2050455) (merged c0c61da0 into 842b599c).

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

by travisbot at 2012-08-07T07:47:31Z

This pull request [passes](http://travis-ci.org/symfony/symfony/builds/2055153) (merged c2207da6 into 842b599c).
2012-08-07 10:07:43 +02:00
sun
3e1a1abd5d Force the value of Dumper::setIndentation($num) to be of type integer. 2012-08-07 09:40:56 +02:00
Jan Marek
890aea2ffe FileLocatorInterface used in typehint instead of FileLocator 2012-08-07 10:39:30 +03:00
jfsimon
c2207da6ab [Console] Removed unused phpunit annotation. 2012-08-07 09:37:46 +02:00
Jean-François Simon
af0149d638 [Console] Added some precision in OutputInterface::write docblock. 2012-08-06 21:34:56 +02:00
Jean-François Simon
c0c61da0be [Console] Added current style appliance for all styled text. 2012-08-06 21:23:53 +02:00
Jean-François Simon
696a65370e [Console] Removed text transformation for empty styles. 2012-08-06 21:22:20 +02:00
Jean-François Simon
c7e324af90 [Console] Added test for non style tag formatting. 2012-08-06 21:21:07 +02:00
hidenorigoto
1a4a4ee93c [DependencyInjection] Fixed a frozen constructor of a container with no parameters 2012-08-07 01:03:17 +09:00
Fabien Potencier
3d32a0bcc2 merged branch beberlei/ConfigFileLoaderTypeMissing (PR #5193)
Commits
-------

b3cf36a [Config] Missing type argument passed to loader.

Discussion
----------

[Config] Missing type argument passed to loader.

In FileLoader the $type is not passed to the child loader.

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

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

by travisbot at 2012-08-06T14:22:30Z

This pull request [passes](http://travis-ci.org/symfony/symfony/builds/2047982) (merged b3cf36af into 89dce2df).
2012-08-06 16:50:56 +02:00
Fabien Potencier
842b599c50 merged branch lsmith77/bundle_inheritance_in_config_dump_reference (PR #5126)
Commits
-------

cdfbe72 handle inheritance in config:dump-reference when a bundle name is passed to the command

Discussion
----------

handle inheritance in config:dump-reference

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

Currently when passing in a bundle name that identifies a bundle that is a parent to another bundle, it will not return the reference for the requested bundle, but for the inheriting (even if that bundle has no configuration class).

F.e.
app/console config:dump-reference SymfonyCmfBlockBundle

will fail if there is a Bundle SandboxBlockBundle that has SymfonyCmfBlockBundle set as the parent.
2012-08-06 16:48:36 +02:00
Benjamin Eberlei
b3cf36af9e [Config] Missing type argument passed to loader.
In FileLoader the $type is not passed to the child loader.
2012-08-06 16:02:40 +02:00
Fabien Potencier
0ccda38775 merged branch Garfield-fr/master (PR #5015)
Commits
-------

f1c4b8b [Doctrine Bridge] Added a parameter ignoreNull on Unique entity to allow a nullable value on field. Added Test

Discussion
----------

[Doctrine Bridge] Added parameter ignoreNull to accept a nullable value on field

In my last project, i use this syntax to test unicity on 2 fields, but it fail because the validator stop if value is null. I dropped the test on validator and my unicity work fine.

```
@UniqueEntity(fields={"username", "deletedAt"})
```

It's possible to add this PR on Bridge.

Thanks

Bertrand

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

by stof at 2012-07-23T08:14:19Z

This is wrong. RDBMS allow several null values in a unique column and this change will break it.

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

by henrikbjorn at 2012-07-23T08:17:08Z

@stof seems weird indeed it would return if any of the values are null. Makes sense to do a query where the field `IS NULL` or whatever the find method does.

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

by stof at 2012-07-23T08:18:50Z

@henrikbjorn if you do a query with IS NULL, the validator would force to have only 1 entity with a null field whereas it is not the behavior of the DB-level constraint.

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

by henrikbjorn at 2012-07-23T08:20:41Z

In this case i suspect that he wants to achieve a `WHERE username = "henrikbjorn" AND deletedAt IS NULL` which would be valid right? Currently it just returns if any of the fields are null and the validation is never done.

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

by bschussek at 2012-07-23T08:27:24Z

I suggest to make this configurable as the handling of NULL values in UNIQUE columns [differs between SQL implementations](http://forums.mysql.com/read.php?22,53591,53591#msg-53591).

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

by Garfield-fr at 2012-07-23T08:52:53Z

@stof What the correct solution to test my unicity with deletedAt == null ?

I use this definition: @ORM\Column(name="deleted_at", type="datetime", nullable=true)

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

by Garfield-fr at 2012-07-23T20:28:44Z

In my local repository, i added a new parameter "$authorizedNullField" on UniqueEntity.php and tested this on UniqueEntityValidator.php:

Code: https://gist.github.com/4122efbe569e3c2c95c0

What about that ?

Thanks for your help

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

by stof at 2012-07-23T20:45:30Z

yep, this would be good (except for the naming which seems weird)

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

by Garfield-fr at 2012-07-23T20:46:44Z

No problem to change this. I don't find a good name for this ?

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

by stof at 2012-07-23T20:47:57Z

what about ``allowMultipleNull`` (defaulting to ``true`` for BC) ?

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

by Garfield-fr at 2012-07-23T20:51:30Z

Why multiple ? This option is for one or many. what about `allowNullable` ?

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

by stof at 2012-07-23T20:52:44Z

@Garfield-fr the current behavior allows having multiple null values without failing to the unique constraint

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

by Garfield-fr at 2012-07-23T20:56:07Z

ok. I make `allowMultipleNull`.

It's ok with that: https://gist.github.com/cae8d43780c45a5011ed

Thanks

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

by bschussek at 2012-07-23T20:58:12Z

What about `uniqueNull` (`false` by default)? `ignoreNull` (`true` by default)? I find `allowMultipleNull` a bit cumbersome.

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

by stof at 2012-07-23T20:58:26Z

no it is not. You have an issue in the validator. You have an extra negation.

Please update your PR

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

by Garfield-fr at 2012-07-23T21:01:59Z

@stof `ignoreNull` is ok for you ?

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

by stof at 2012-07-23T21:10:24Z

yes

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

by fabpot at 2012-08-05T07:48:03Z

Is it mergeable now? Is yes, @Garfield-fr Can you squash your commits?

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

by travisbot at 2012-08-05T08:43:23Z

This pull request [fails](http://travis-ci.org/symfony/symfony/builds/2039523) (merged 19ae3cf9 into c20c1d18).

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

by stof at 2012-08-05T12:09:02Z

@Garfield-fr when squashing the commits, you need to force the push as you are rewriting the history. You should not have merged with your remote branch

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

by Garfield-fr at 2012-08-05T12:10:15Z

What's the right solution for resolve this ?

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

by stof at 2012-08-05T12:11:09Z

@Garfield-fr reset your local branch to the squashed commit and force the push

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

by Garfield-fr at 2012-08-05T12:14:09Z

@stof Thanks for your help

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

by travisbot at 2012-08-05T12:19:06Z

This pull request [fails](http://travis-ci.org/symfony/symfony/builds/2040210) (merged f1c4b8b4 into 20d2e5a1).
2012-08-06 10:17:10 +02:00
Fabien Potencier
ca9f5e8db3 merged branch modi/master (PR #5186)
Commits
-------

83269a4 update zh_CN translations of Form Component

Discussion
----------

update zh_CN translations of Form Component

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

by travisbot at 2012-08-06T01:45:01Z

This pull request [fails](http://travis-ci.org/symfony/symfony/builds/2044024) (merged 83269a46 into 20d2e5a1).
2012-08-06 09:40:57 +02:00
modi
83269a46cb update zh_CN translations of Form Component 2012-08-06 09:36:49 +08:00
Christophe Coevoet
85187ec266 [DoctrineBridge] Fixed the testsuite 2012-08-05 14:43:59 +02:00
Fran Moreno
3d5b1dbfff [Validator] Updated Catalonian translations y fixed typos in Spanish 2012-08-05 12:26:28 +02:00
Bertrand Zuchuat
f1c4b8b415 [Doctrine Bridge] Added a parameter ignoreNull on Unique entity to allow a nullable value on field. Added Test 2012-08-05 10:35:10 +02:00
sun
5be7237b69 Added Yaml\Dumper::setIndentation() method to allow a custom indentation level of nested nodes.
YAML does not specify an absolute indentation level, but a consistent indentation of nested nodes only: http://www.yaml.org/spec/1.2/spec.html#space/indentation/

Projects that are generally using 2 spaces for indentation should be able to retain consistency with their coding standards by supplying a custom value for the new $indent parameter added to Yaml::dump(), or the new Dumper::setIndentation() method.

The new parameter is a backwards-compatible API addition and defaults to the previous default of 4 (which was changed from 2 via PR #2242 only recently).
2012-08-05 08:07:18 +02:00
Tobias Schultze
0706d18adc [Routing] fixed 4 bugs in the UrlGenerator 2012-08-05 05:44:00 +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
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
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
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