Commit Graph

12913 Commits

Author SHA1 Message Date
Fabien Potencier
3245c1ce3a merged branch pborreli/typophpdoc (PR #6710)
This PR was merged into the master branch.

Commits
-------

b1c6881 Fixed PHPDoc

Discussion
----------

Fixed PHPDoc
2013-01-12 08:12:39 +01:00
Fabien Potencier
5fb9bc6af6 merged branch jorgemartind/patch-1 (PR #6709)
This PR was merged into the master branch.

Commits
-------

9d31064 Update src/Symfony/Component/Security/Resources/translations/security.es_CA.xlf

Discussion
----------

Update src/Symfony/Component/Security/Resources/translations/security.es...

..._CA.xlf

[Security] update catalonian translation
2013-01-12 08:12:01 +01:00
Fabien Potencier
9a579062b0 merged branch lazyhammer/security-translations (PR #6711)
This PR was merged into the master branch.

Commits
-------

0a060ca Fix Russian and Ukrainian translations for Security component

Discussion
----------

[Security] Fix Russian and Ukrainian translations
2013-01-12 08:11:32 +01:00
Fabien Potencier
36b946932f merged branch umpirsky/security-sr-cyrl (PR #6713)
This PR was merged into the master branch.

Commits
-------

67f7ed5 Added Serbian Cyrillic tanslation for security component

Discussion
----------

Added Serbian Cyrillic tanslation for security component
2013-01-12 08:10:33 +01:00
umpirsky
67f7ed5358 Added Serbian Cyrillic tanslation for security component 2013-01-11 19:40:23 +01:00
Fran Moreno
eeceafa45c [Security] Renamed catalonian translation file 2013-01-11 19:36:08 +01:00
Alex Olmos
fb52d941f4 Update src/Symfony/Component/Security/Resources/translations/security.es_CA.xlf 2013-01-11 19:16:45 +01:00
Pascal Borreli
b1c68815f5 Fixed PHPDoc 2013-01-11 17:38:19 +00:00
Dmitrii Chekaliuk
0a060cabeb Fix Russian and Ukrainian translations for Security component 2013-01-11 19:28:56 +02:00
jorgemartind
9d310647e9 Update src/Symfony/Component/Security/Resources/translations/security.es_CA.xlf
[Security] update catalonian translation
2013-01-11 18:10:54 +01:00
Fabien Potencier
dc2cc6b13c [Console] fixed input bug when the value of an option is empty (closes #6649, closes #6689) 2013-01-11 14:49:52 +01:00
Fabien Potencier
92f951fd7a merged branch LawnGnome/PHP-5.5-compat (PR #6647)
This PR was merged into the 2.1 branch.

Commits
-------

4991607 Fix version_compare() calls for PHP 5.5.
34def9f Handle the deprecation of IntlDateFormatter::setTimeZoneId() in PHP 5.5.

Discussion
----------

[Form] [Locale] PHP 5.5 compatibility fixes

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

IntlDateFormatter::setTimeZoneId() is deprecated in PHP 5.5, which results in E_DEPRECATED errors when using the date form type. This PR works around that.

Furthermore, the version_compare() tests used in locale to detect PHP 5.5 are broken with snapshot and Git builds of PHP. I've also committed a fix for those tests in this PR.

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

by stof at 2013-01-10T08:24:15Z

shouldn't it even be done in 2.0 as it is a bugfix ?

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

by LawnGnome at 2013-01-11T00:49:11Z

Possibly — I don't know enough about Symfony's release management to know whether this is appropriate for 2.0, and I was mostly scratching my own itch, honestly.

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

by stof at 2013-01-11T01:51:35Z

well, it is a bugfix and 2.0 is also impacted, so it should be done in it.

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

by LawnGnome at 2013-01-11T02:52:21Z

The diff for 2.0 looks like it'll be just the StubIntlDateFormatter.php changes — the deprecated method isn't called in DateType on that branch, and there aren't any StubIntlDateFormatter tests on 2.0. How do you want that submitted — as a separate PR against 2.0?

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

by fabpot at 2013-01-11T07:20:18Z

@LawnGnome A separate pull request would be good. Thanks.

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

by LawnGnome at 2013-01-11T08:29:48Z

2.0 PR added as #6699.
2013-01-11 14:37:17 +01:00
Fabien Potencier
e463a63906 Merge branch '2.0' into 2.1
* 2.0:
  Fix version_compare() calls for PHP 5.5.
  [Process] In edge cases `getcwd()` can return `false`, then `proc_open()` should get `null` to use default value (the working dir of the current PHP process)

Conflicts:
	src/Symfony/Component/Form/Extension/Core/ChoiceList/MonthChoiceList.php
2013-01-11 14:37:04 +01:00
Fabien Potencier
b4c6972025 merged branch LawnGnome/PHP-5.5-compat-2.0 (PR #6699)
This PR was merged into the 2.0 branch.

Commits
-------

c7bfce9 Fix version_compare() calls for PHP 5.5.

Discussion
----------

[2.0] [Form] [Locale] PHP 5.5 compatibility fixes

Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: unknown, can't run the test suite on 2.0 due to `Doctrine\DBAL\Logging\DebugStack` not being found
Fixes the following tickets: N/A
Todo: None
License of the code: MIT
Documentation PR: N/A

A backport of #6647 to the Symfony 2.0 branch, as requested. This affects a couple of files that aren't affected on 2.1.
2013-01-11 14:35:59 +01:00
Fabien Potencier
aec3c8aa1d merged branch Burgov/patch-3 (PR #6702)
This PR was merged into the master branch.

Commits
-------

6b669fb Update src/Symfony/Component/Security/Resources/translations/security.nl.xlf

Discussion
----------

Update src/Symfony/Component/Security/Resources/translations/security.nl.xlf

see #6668

Some more minor tweaks
2013-01-11 14:34:34 +01:00
Fabien Potencier
1d548d4168 merged branch Engerim/patch-1 (PR #6706)
This PR was merged into the master branch.

Commits
-------

f127781 Update src/Symfony/Bundle/FrameworkBundle/Controller/Controller.php

Discussion
----------

[FrameworkBundle] add missing use statement HttpKernelInterface for forward method

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

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

by lsmith77 at 2013-01-11T13:31:01Z

+1
2013-01-11 14:33:21 +01:00
Fabien Potencier
d96b96e942 merged branch cristobal/master (PR #6707)
This PR was merged into the master branch.

Commits
-------

83d0469 Create security.no.xlf

Discussion
----------

Norwegian Translation for Security

Norwegian Translation
2013-01-11 14:15:10 +01:00
Fabien Potencier
9e1ca1916b merged branch 2085020/master (PR #6705)
This PR was squashed before being merged into the master branch (closes #6705).

Commits
-------

5ee65aa Contribution to translation to Catalan of the security messages

Discussion
----------

Contribution to translation to Catalan of the security messages

Contribution to translation to Catalan of the security messages
2013-01-11 14:12:54 +01:00
Joan Cruz
5ee65aa8be Contribution to translation to Catalan of the security messages 2013-01-11 14:12:53 +01:00
Cristobal Dabed
83d04699d2 Create security.no.xlf
Norwegian Translation
2013-01-11 05:12:25 -08:00
Maks Slesarenko
3ae5b55882 added support for propel enum types in PropelTypeGuesser 2013-01-11 07:44:40 -05:00
Alexander Miehe
f127781f2e Update src/Symfony/Bundle/FrameworkBundle/Controller/Controller.php
Add use HttpKernelInterface for refactored forward method
2013-01-11 13:33:14 +01:00
Fabien Potencier
9b92e8ecd3 merged branch stephpy/redis_profiler_sort (PR #6703)
This PR was merged into the 2.1 branch.

Commits
-------

9257b03 [Profiler] [Redis] Fix sort of profiler rows.

Discussion
----------

[Profiler] [Redis] Fix sort of redis storage profiler rows.

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

Redis profiler rows are not sorted as expected.

We have in redis:

```
- 2011-01-01 ...
- 2011-01-02 ...
- 2011-01-03 ...
```

If we limit to 2, we'll have:

```
- 2011-01-02 ...
- 2011-01-01 ...
```

Fixed this bug by reversing array.
2013-01-11 12:37:16 +01:00
Fabien Potencier
69aa428d47 merged branch stloyd/bugfix/nulllogger (PR #6704)
This PR was merged into the master branch.

Commits
-------

eb0d2ab [HttpKernel] Remove conflicting `use` from `NullLogger`

Discussion
----------

[HttpKernel] Remove conflicting `use` from `NullLogger`

Without this code dies with fatal:
> Cannot use Psr\Log\LoggerInterface as LoggerInterface because the name is already in use

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

by Seldaek at 2013-01-11T11:00:50Z

Oops :)
2013-01-11 12:17:32 +01:00
Stéphane PY
9257b0371c [Profiler] [Redis] Fix sort of profiler rows. 2013-01-11 11:35:43 +01:00
Joseph Bielawski
eb0d2abb1b [HttpKernel] Remove conflicting use from NullLogger 2013-01-11 11:33:37 +01:00
Bart van den Burg
6b669fbddf Update src/Symfony/Component/Security/Resources/translations/security.nl.xlf
see #6668

Some more minor tweaks
2013-01-11 10:49:55 +01:00
Fabien Potencier
3d808b59de merged branch sineld/master (PR #6700)
This PR was merged into the master branch.

Commits
-------

2617cf6 Added Turkish translation for security component

Discussion
----------

Added Turkish translation for security component
2013-01-11 09:57:54 +01:00
Sinan Eldem
2617cf64c3 Added Turkish translation for security component 2013-01-11 10:47:35 +02:00
Fabien Potencier
6c3393a96a merged branch Seldaek/wording (PR #6698)
This PR was merged into the master branch.

Commits
-------

8d06c57 [HttpFoundation] Fix sentence and provide a hint at the solution for affected people

Discussion
----------

[HttpFoundation] Fix sentence and provide a hint at the solution for affected people
2013-01-11 09:27:47 +01:00
Jordi Boggiano
8d06c571ed [HttpFoundation] Fix sentence and provide a hint at the solution for affected people 2013-01-11 09:20:00 +01:00
Fabien Potencier
a31a6531c7 [HttpKernel] fixed usage of false as a valid strategy (for BC) 2013-01-11 09:12:57 +01:00
Adam Harvey
c7bfce9116 Fix version_compare() calls for PHP 5.5.
Until PHP 5.5 hits beta, the version number for Git builds is still 5.5.0-dev,
which is less than 5.5.0alpha1 according to version_compare(). This means that
the branches for 5.5 aren't being executed on 5.5 snapshots at present.
2013-01-11 16:02:30 +08:00
Fabien Potencier
9f25451134 merged branch stephpy/redis_profiler (PR #6680)
This PR was merged into the master branch.

Commits
-------

d027f45 [PROFILER][REDIS] Support database, auth on redis connection

Discussion
----------

[PROFILER][REDIS] Support database, auth on redis connection

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

Allow database and password on dsn:

```yml
framework:
    profiler:
        dsn: redis://127.0.0.1:6379
        dsn: redis://127.0.0.1:6379/3
        dsn: redis://user:password@127.0.0.1:6379/3
```

Since redis uses only password for authentification, user will not be used ...

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

by shouze at 2013-01-10T16:58:02Z

👍 db selection is a must have
2013-01-11 08:49:43 +01:00
Fabien Potencier
b58e8ce9aa merged branch fabpot/kernel-refactor (PR #6459)
This PR was merged into the master branch.

Commits
-------

76fefe3 updated CHANGELOG and UPGRADE files
f7da1f0 added some unit tests (and fixed some bugs)
f17f586 moved the container aware HTTP kernel to the HttpKernel component
2eea768 moved the deprecation logic calls outside the new HttpContentRenderer class
bd102c5 made the content renderer work even when ESI is disabled or when no templating engine is available (the latter being mostly useful when testing)
a8ea4e4 [FrameworkBundle] deprecated HttpKernel::forward() (it is only used once now and not part of any interface anyway)
1240690 [HttpKernel] made the strategy a regular parameter in HttpContentRenderer::render()
adc067e [FrameworkBundle] made some services private
1f1392d [HttpKernel] simplified and enhanced code managing the hinclude strategy
403bb06 [HttpKernel] added missing phpdoc and tweaked existing ones
892f00f [HttpKernel] added a URL signer mechanism for hincludes
a0c49c3 [TwigBridge] added a render_* function to ease usage of custom rendering strategies
9aaceb1 moved the logic from HttpKernel in FrameworkBundle to the HttpKernel component

Discussion
----------

[WIP] Kernel refactor

Currently, the handling of sub-requests (including ESI and hinclude) is mostly done in FrameworkBundle. It makes these important features harder to implement for people using only HttpKernel (like Drupal and Silex for instance).

This PR moves the code to HttpKernel instead. The code has also been refactored to allow easier integration of other rendering strategies (refs #6108).

The internal route has been re-introduced but it can only be used for trusted IPs (so for the internal rendering which is managed by Symfony itself, or by a trusted reverse proxy like Varnish for ESI handling). For the hinclude strategy, when using a controller, the URL is automatically signed (see #6463).

The usage of a listener instead of a controller to handle internal sub-requests speeds up things quite a lot as it saves one sub-request handling. In Symfony 2.0 and 2.1, the handling of a sub-request actually creates two sub-requests.

Rendering a sub-request from a controller can be done with the following code:

```jinja
{# default strategy #}
{{ render(path("partial")) }}
{{ render(controller("SomeBundle:Controller:partial")) }}

{# ESI strategy #}
{{ render(path("partial"), { strategy: 'esi' }) }}
{{ render(controller("SomeBundle:Controller:partial"), { strategy: 'esi' }) }}

{# hinclude strategy #}
{{ render(path("default1"), { strategy: 'hinclude' }) }}
```

The second commit allows to simplify the calls a little bit thanks to some nice syntactic sugar:

```jinja
{# default strategy #}
{{ render(path("partial")) }}
{{ render(controller("SomeBundle:Controller:partial")) }}

{# ESI strategy #}
{{ render_esi(path("partial")) }}
{{ render_esi(controller("SomeBundle:Controller:partial")) }}

{# hinclude strategy #}
{{ render_hinclude(path("default1")) }}
```

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

by fabpot at 2013-01-03T17:58:49Z

I've just pushed a new version of the code that actually works in my browser (but I've not yet written any unit tests). I've updated the PR description accordingly.

All comments welcome!

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

by Koc at 2013-01-03T20:11:43Z

what about `render(controller="SomeBundle:Controller:partial", strategy="esi")`?

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

by stof at 2013-01-04T09:01:01Z

shouldn't we have interfaces for the UriSigner and the HttpContentRenderer ?

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

by lsmith77 at 2013-01-04T19:28:09Z

btw .. as mentioned in #6213 i think it would make sense to refactor the HttpCache to use a cache layer to allow more flexibility in where to cache the data (including clustering) and better invalidation. as such if you are refactoring HttpKernel .. it might also make sense to explore splitting off HttpCache.

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

by fabpot at 2013-01-04T19:30:07Z

@lsmith77 This is a totally different topic. This PR is just about moving things from FrameworkBundle to HttpKernel to make them more reusable outside of the full-stack framework.

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

by fabpot at 2013-01-05T09:39:52Z

I think this PR is almost ready now. I still need to update the docs and add some unit tests. Any other comments on the whole approach? The class names? The `controller` function thingy? The URI signer mechanism? The proxy protection for the internal controller? The proxy to handle internal routes?

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

by sstok at 2013-01-05T10:08:25Z

Looks good to me 👍

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

by sdboyer at 2013-01-07T18:17:08Z

@Crell asked me to weigh in, since i'm one of the Drupal folks who's likely to work most with this.

i think i've grokked about 60% of the big picture here, and i'm generally happy with what i see. the assumption that the HInclude strategy makes about working with templates probably isn't one that we'll be able to use (and so, would need to write our own), but that's not a big deal since the whole goal here is to make strategies pluggable.

so, yeah. +1.

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

by winzou at 2013-01-09T20:21:44Z

Just for my information: will this PR be merged for 2.2 version? Thanks.

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

by stof at 2013-01-09T20:41:04Z

@winzou according to the blog post announcing the beta 1 release, yes. It is explicitly listed as being one of the reason to make it a beta instead of the first RC.

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

by winzou at 2013-01-09T20:49:36Z

OK thanks, I've totally skipped this blog post.

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

by fabpot at 2013-01-10T15:26:15Z

I've just added a bunch of unit tests and fix some bugs I found while writing the tests.
2013-01-11 08:24:18 +01:00
Fabien Potencier
2aba3aa490 [HttpFoundation] added missing info in CHANGELOG 2013-01-11 08:05:42 +01:00
Fabien Potencier
a0c26e0335 merged branch Seldaek/jsonresp (PR #6635)
This PR was submitted for the 2.1 branch but it was merged into the master branch instead (closes #6635).

Commits
-------

26aafff [HttpFoundation] Remove special handling of empty arrays, fixes #5506

Discussion
----------

[HttpFoundation] Remove special handling of empty arrays, fixes #5506

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

See the linked issue for details, IMO it should be removed because it's not consistently applied and just a WTF for people.

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

by vicb at 2013-01-09T11:11:06Z

👍, could you please update the changelog with the BC break ?

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

by Seldaek at 2013-01-09T11:16:44Z

If we really consider this as a BC break and document it as such then I guess it should be 2.2 only and not 2.1. @fabpot?

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

by vicb at 2013-01-09T11:28:16Z

IMO there is no such things as "tiny BC" but BCs are yes/no.

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

by fabpot at 2013-01-09T15:09:18Z

Let's do it in master only and add a note in the CHANGELOG about the BC break.
2013-01-11 08:01:56 +01:00
Jordi Boggiano
2d07a17cbd Remove special handling of empty arrays, fixes #5506 2013-01-11 08:01:56 +01:00
Fabien Potencier
b868bf6249 merged branch lmcd/php-sapi (PR #6636)
This PR was merged into the master branch.

Commits
-------

16b3426 Show PHP SAPI in WDT

Discussion
----------

[WDT] Show PHP SAPI in WDT

PHP running under Apache as a module:
![sapi-apache](https://f.cloud.github.com/assets/363540/53093/7709dc8a-5a48-11e2-8c09-031e0645e3ea.png)

PHP running with the in-built CLI web server (via `server:run`)
![sapi-cli](https://f.cloud.github.com/assets/363540/53094/96df9a0e-5a48-11e2-96e9-7bc2f452083d.png)
2013-01-11 08:00:38 +01:00
Fabien Potencier
b3abf45ae9 merged branch jankramer/property-path-setter-fix (PR #6696)
This PR was merged into the master branch.

Commits
-------

69535cf Fixed broken setter in Form/Util/PropertyPath

Discussion
----------

[Form] Fixed broken setter in Form/Util/PropertyPath

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:

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

by bschussek at 2013-01-11T06:54:15Z

+1
2013-01-11 07:56:54 +01:00
Fabien Potencier
3095765bb1 merged branch jakzal/no-underscored-methods-in-tests-2.1 (PR #6695)
This PR was merged into the 2.1 branch.

Commits
-------

8024262 Removed underscores from test method names to be consistent with other components.

Discussion
----------

Removed underscores from test method names to be consistent with other components

This is just a cosmetic change. It is more common (in Symfony) to use fully camel-cased names for test methods. Only some of the test methods contain underscores. To avoid confusion it is better to be consistent.

Bug fix: no
Feature addition: no
Backwards compatibility break: no
Fixes the following tickets: -
Todo: -
License of the code: MIT
Documentation PR: -
2013-01-11 07:55:32 +01:00
Jan Kramer
69535cfe42 Fixed broken setter in Form/Util/PropertyPath 2013-01-11 07:43:26 +01:00
Jakub Zalas
802426272f Removed underscores from test method names to be consistent with other components.
It is more common to use fully camel-cased names for test methods. Only some of the test methods are called with underscore notation. To avoid confusion it is better to be consistent.
2013-01-11 00:31:43 +00:00
Fabien Potencier
0acefc9a81 merged branch sstok/patch-3 (PR #6691)
This PR was merged into the master branch.

Commits
-------

08f9c76 Update src/Symfony/Component/Security/Resources/translations/security.nl.xlf

Discussion
----------

Minor tone of voice correction in security.nl.xlf

For the Dutch people under us. http://www.kiezelcommunicatie.nl/kiezelblog/woorden-die-niet-meer-mogen-aflevering-1/

Yes I'm picky ;)
2013-01-10 23:25:39 +01:00
Fabien Potencier
8c4245f2a8 merged branch tiagobrito/master (PR #6693)
This PR was merged into the master branch.

Commits
-------

0d6be2e Added Portuguese (Portugal) translation to Security
87df0b7 Merge pull request #1 from symfony/master

Discussion
----------

Add Portuguese from Portugal Security translation

Translation file for portuguese from Portugal added in Security component translations
2013-01-10 23:25:26 +01:00
Tiago Brito
0d6be2e81a Added Portuguese (Portugal) translation to Security
Added Portuguese from Portugal translation for Security component
2013-01-10 22:01:22 +00:00
Tiago Brito
87df0b7ee2 Merge pull request #1 from symfony/master
update symfony repo
2013-01-10 13:37:17 -08:00
Sebastiaan Stok
08f9c7633e Update src/Symfony/Component/Security/Resources/translations/security.nl.xlf
For the Dutch people under us. http://www.kiezelcommunicatie.nl/kiezelblog/woorden-die-niet-meer-mogen-aflevering-1/

Yes I'm picky ;)
2013-01-10 19:55:35 +01:00
Fabien Potencier
39686077f8 merged branch bschussek/property-path (PR #6595)
This PR was merged into the master branch.

Commits
-------

6b1652e [PropertyAccess] Property path, small refactoring, read/writeProperty to read/write Property/Index.
1bae7b2 [PropertyAccess] Extracted PropertyAccess component out of Form

Discussion
----------

[PropertyAccess] Extracted PropertyAccess component out of Form

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

TODO: adapt DoctrineBundle/PropelBundle to pass the "property_accessor" service to EntityType/ModelType

Usage:

```php
$accessor = PropertyAccess::getPropertyAccessor();

// equivalent to $object->getFoo()->setBar('value')
$accessor->setValue($object, 'foo.bar', 'value');

// equivalent to $object->getFoo()->getBar()
$accessor->getValue($object, 'foo.bar');

// equivalent to $object->getFoo()['bar']
$accessor->getValue($object, 'foo[bar]');

// equivalent to $array['foo']->setBar('value')
$accessor->setValue($array, '[foo].bar', 'value');

// equivalent to $array['foo']['bar']
$accessor->getValue($array, '[foo][bar]');
```

Later on, once we have generation and caching of class-specific accessors, configuration will be something like this (consistent with the Form and Validator component):

```php
$accessor = PropertyAccess::getPropertyAccessorBuilder()
    ->setCacheDirectory(__DIR__ . '/cache')
    ->setCacheLifeTime(86400)
    ->enableMagicGetSet()
    ->enableMagicCall()
    ->getPropertyAccessor();
```

or

```php
$accessor = PropertyAccess::getPropertyAccessorBuilder()
    ->setCache($cache)
    ->getPropertyAccessor();
```

etc.

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

by Burgov at 2013-01-07T08:48:15Z

+1. I use this feature outside of the Form context a lot

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

by stof at 2013-01-07T08:49:34Z

The classes in the Form component should be kept for BC (and deprecated) for people using the feature

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

by michelsalib at 2013-01-07T10:02:19Z

YES YES YES 👍. Sorry for my enthusiasm, but I already copy pasted the PropertyPath class to some of my libraries to avoid linking to the whole Form component. I thus will be glad to officially use this component into my libraries via composer.

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

by norzechowicz at 2013-01-07T10:17:39Z

Same as @michelsalib to avoid linking full Form component I was using copied parts of code. Can't wait to use this component in my lib. 👍

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

by bschussek at 2013-01-07T10:43:41Z

I split away `getValue()` and `setValue()` from `PropertyPath` into a new class `ReflectionGraph`. The component is also named ReflectionGraph now.

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

by michelsalib at 2013-01-07T10:47:10Z

I am not found of the name. What do you intend to do in the component more than what PropertyPath does ?

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

by bschussek at 2013-01-07T10:58:59Z

@michelsalib A `PropertyPath` is simply a string like `foo.bar[baz]`. `getValue()` and `setValue()` interpret this path. There may be different interpretations for the same path, so these methods were split into a new class.

I chose the name `ReflectionGraph` because the functionality is very similar to `ReflectionProperty`.

```php
$reflProperty = new ReflectionProperty('Vendor/Class', 'property');
$reflProperty->setValue($object, 'foo');

$reflGraph = new ReflectionGraph();
$reflGraph->setValue($object, 'property.path', 'foo');
```

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

by michelsalib at 2013-01-07T11:00:42Z

What about naming it `Reflection`, maybe sometime we will want to add more reflection tools for classes, interfaces... ?

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

by bschussek at 2013-01-07T11:02:32Z

@michelsalib I doubt that we will do that. PHP's implementation is sufficient.

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

by vicb at 2013-01-07T11:03:57Z

> Backwards compatibility break: no

Really ?

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

by michelsalib at 2013-01-07T11:05:07Z

Well, that is just a suggestion. If I am the only one to oppose, I won't complain.

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

by bschussek at 2013-01-07T11:09:08Z

> Really ?

@vicb Would you please refrain from such meanginless comments in the future? I'm getting a bit tired of them. If you think that BC is broken somewhere, tell me where so that I can fix it.

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

by stof at 2013-01-07T11:09:43Z

@vicb There is no BC break as he kept deprecated classes for BC

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

by norzechowicz at 2013-01-07T11:13:12Z

@bschussek what do you think about some kind of factory for Reflection? This will prevent creating new Reflection objects each time you want to access properties values.

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

by vicb at 2013-01-07T11:18:47Z

@bschussek my point is that my comment is no more meaningless than closing #6453 because it will break BC.We could also keep BC by extending the classes in the new ns but in both cases BC will ultimately be broken (when the legacy classes are removed)

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

by vicb at 2013-01-07T12:23:45Z

@bschussek @stof I think that modifying the constructor signatures of `EntityChoiceList`, `FormType` are BC breaks (this is not an exhaustive list)

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

by bschussek at 2013-01-07T12:35:13Z

@vicb You are right. I added corresponding entries to the CHANGELOG and adapted the above description.

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

by vicb at 2013-01-08T13:39:13Z

@bschussek looking at this PR, I was wondering if an alternate syntax would make sense:

```php
<?php
$reflGraph = new ReflectionGraph($object);

// equivalent to $object->getFoo()->setBar('value')
$reflGraph['foo.bar'] = 'value';

// equivalent to $object->getFoo()->getBar()
$reflGraph['foo.bar'];
```

_Sorry for the off topic_

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

by vicb at 2013-01-08T13:49:46Z

The advantage of using such a `ReflectionGraph` factory is that it might be easier to return specialized reflection graphs, ie optimized instances (that would be cached).

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

by Toflar at 2013-01-08T14:49:54Z

I was also puzzled by the fact that there will be many `ReflectionGraph` instances although they don't have to. I'm with @vicb and I'd also vote for using the constructor to set the subject you're working on. Otherwise you'll repeat yourself over and over again by passing the subject - say `$object` - to `getValue()` or `setValue()`. If however you don't like the constructor thing then why do we have to have an instance of `ReflectionGraph` rather than just go for static methods and use `ReflectionGraph::getValue()` and `ReflectionGraph::setValue()`?

In my opinion there are a few methods that could be static anyway (especially some private ones) :)

But probably I misunderstood something as I'm just about to discover the SF components and don't have any experience working with them (so basically I just read the PR because of @bschussek's tweet :D)

Couldn't come up with any intuitive name for the component though :(
Generally when we talk about "getting" and "setting" values we call those things "mutators"...so `GraphMutator` might be more intuitive than the word `Reflection` :)

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

by Taluu at 2013-01-08T14:57:42Z

I like the last proposition made by @vicb (implementing `ArrayAccess` on `ReflectionGraph` - or whatever name will be chosen (`PathMutator` for example :D), and also specify which object should be worked on in the constructor rather than in each method).

Would this also be used in the `Validator` component ?

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

by stof at 2013-01-08T15:16:12Z

@Toflar A static ``ReflectionGraph::getValue()`` means you have a coupling to the implementation (as with any static call). The current implementation allows you to replace it with your own implementation as long as you implement the interface as it follows the DI pattern (as done in other places in Symfony).

@vicb The issue with ``$reflGraph = new ReflectionGraph($object);`` is that you cannot inject the ReflectionGraph anymore, as you need a new one each time. This would mean adding a ``ReflectionGraphFactory`` to be injected (and which could then be replaced by a factory using code generation). Using the constructor directly would not allow using a replacement based on code generation later. So the resulting code would more likely be

```php

$reflGraph = new ReflectionGraph();

$mutator = $reflGraph->getMutator($object);

// equivalent to $object->getFoo()->setBar('value')
$mutator['foo.bar'] = 'value';

// equivalent to $object->getFoo()->getBar()
$mutator['foo.bar'];
```

Btw, writing this, I find the naming Mutator suggested by @Taluu good when it concerns the setter, but quite weird when getting the value.

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

by Taluu at 2013-01-08T15:21:00Z

I was not the one to suggest though, it was @everzet. But then something like `PathAccessor`, as it is both a mutator and a getter ? I also like @stof suggestion, still in the idea of avoiding to have to put the object as an argument and also allowing to use an `ArrayAccess` interface..

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

by vicb at 2013-01-08T15:21:54Z

@stof your remark makes sense.

What about `Accessor`, the benefit being that it might well be the name of a coming PHP feature: https://wiki.php.net/rfc/propertygetsetsyntax-v1.2

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

by everzet at 2013-01-08T15:27:02Z

```php
$manager = new PropertyManager(new PropertyPath());
$num = $manager->getValue($object, 'foo.num');
$manager->setValue($object, 'foo.num', $num + 1);

$objectManager = new ObjectPropertyManager($object[, $manager]);
$num = $objectManager->getValue('foo.num');
$objectManager->setValue('foo.num', $num + 1);

$objectManager['foo.num'] += 1;
```

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

by bschussek at 2013-01-08T15:28:01Z

It might be me, but I don't like `ArrayAccess` to be misused for features like that. If I access a key in an array access structure, I expect it to be something like a collection, an associative array or a key value store. This class is neither.

Putting that aside, an accessor for a specific object might make sense, but I'm not sure about that yet.

```php
$reflObject->setValue('foo.bar', 'value');
$reflObject->getValue('foo.bar');
```

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

by stof at 2013-01-08T15:28:52Z

@vicb I would vote for PathAccessor then, as we are not doing simple accessor but accessors through a path in an object graph.
In my snippet above, we would then have a ReflectionGraph instance and a PathAccessor instance (``$mutator``).

Btw, I would also keep the methods ``setValue`` and ``getValue``. I find it more clear.

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

by bschussek at 2013-01-08T15:32:07Z

@stof But then we're rather left with the question of ReflectionGraph **vs.** PathAccessor. I don't think that the tiny interface difference (one global, one object-based) justifies the big naming difference.

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

by vicb at 2013-01-08T15:33:24Z

> This class is neither.

It might be `$pa['foo.bar[baz]'] = $pa['foo.bar']['baz'];` I don't know if it would help though.

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

by stof at 2013-01-08T15:35:51Z

@bschussek In my suggestion, ``ReflectionGraph`` is a factory for the PathAccessor objects. It is not accessing anymore itself (which would probably continue to cause issues to implement it with code generation). But the naming could indeed be changed to something else.
2013-01-10 19:35:24 +01:00
Fabien Potencier
357d747311 merged branch theUniC/master (PR #6684)
This PR was merged into the master branch.

Commits
-------

1edf302 Fixed some translation typos

Discussion
----------

Fixed translation typos on the Security componente

Hi,

In my last PR I've introduced some translation typos on the Security component messages for the Spanish translation.

So sorry.

Christian.
2013-01-10 19:21:27 +01:00