Commit Graph

29567 Commits

Author SHA1 Message Date
Maxime Steinhausser
366aefd75f [SecurityBundle] UserPasswordEncoderCommand: ask user class choice question 2017-02-16 16:01:42 +01:00
Fabien Potencier
c3230f0a97 minor #20896 [Console] Enhance MarkdownDescriptor (ogizanagi)
This PR was squashed before being merged into the 3.3-dev branch (closes #20896).

Discussion
----------

[Console] Enhance MarkdownDescriptor

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | N/A
| License       | MIT
| Doc PR        | N/A

In order to add usefulness to this descriptor, this PR allows to jump to a command description by clicking on the command name on the application summary.

It's not a generic approach but IMHO a quick win that should work at least for Github flavoured markdown.

The markdown format should also avoid using `Application::getLongVersion` as the markdown document title, as it may contain tags (and unnecessary information using the framework).

Lastly, the markdown format is now cleaned from tags initially used for console output formatting and only keeps properly escaped ones.

Commits
-------

ef5b087b4f Do not output formatting tags
6896865bcc [Console] MarkdownDescriptor: Don't use getLongVersion
fc2395e237 [Console] MarkdownDescriptor: Link to commands anchors
2017-02-16 06:18:56 -08:00
Fabien Potencier
6580a49706 Merge branch '3.2'
* 3.2:
  Permit empty suffix on Windows
  fixed CS
  [FrameworkBundle] Remove unused import
  [Console][Table] fixed render when using multiple rowspans.
  add docblocks for Twig url and path function to improve ide completion
  check for circular refs caused by method calls
  [Serializer] fix upper camel case conversion (see #21399)
  [DI] Auto register extension configuration classes as a resource
  [Console] Updated phpdoc on return types
2017-02-16 06:15:30 -08:00
Fabien Potencier
b3ba37d862 Merge branch '2.8' into 3.2
* 2.8:
  Permit empty suffix on Windows
  [Console][Table] fixed render when using multiple rowspans.
  add docblocks for Twig url and path function to improve ide completion
  check for circular refs caused by method calls
  [Serializer] fix upper camel case conversion (see #21399)
  [DI] Auto register extension configuration classes as a resource
  [Console] Updated phpdoc on return types
2017-02-16 06:07:22 -08:00
Fabien Potencier
e103e1d1db Merge branch '2.7' into 2.8
* 2.7:
  Permit empty suffix on Windows
  [Console][Table] fixed render when using multiple rowspans.
  add docblocks for Twig url and path function to improve ide completion
  check for circular refs caused by method calls
  [Serializer] fix upper camel case conversion (see #21399)
  [DI] Auto register extension configuration classes as a resource
  [Console] Updated phpdoc on return types
2017-02-16 06:06:24 -08:00
Fabien Potencier
3860b0b392 optimized code 2017-02-16 05:36:15 -08:00
Fabien Potencier
02166d0101 fixed CS 2017-02-16 05:35:07 -08:00
Fabien Potencier
923d50b625 feature #21283 [Form][FrameworkBundle] Move FormPass to the Form component (chalasr)
This PR was merged into the 3.3-dev branch.

Discussion
----------

[Form][FrameworkBundle] Move FormPass to the Form component

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | yes
| Tests pass?   | yes
| Fixed tickets | n/a
| License       | MIT
| Doc PR        | n/a

So that anyone using only Form and DI can use it for registering form types/type guessers.
Follows #19443, related to #21284

Commits
-------

e68a6d963c [FrameworkBundle][Form] Move FormPass to the Form component
2017-02-16 05:34:28 -08:00
Fabien Potencier
846d24ae36 feature #21293 [FrameworkBundle][Serializer] Move SerializerPass to the Serializer (chalasr)
This PR was merged into the 3.3-dev branch.

Discussion
----------

[FrameworkBundle][Serializer] Move SerializerPass to the Serializer

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | yes
| Tests pass?   | yes
| Fixed tickets | n/a
| License       | MIT
| Doc PR        | n/a

Part of #21284

Commits
-------

95cf5084c0 [FrameworkBundle][Serializer] Move SerializerPass to the Serializer
2017-02-16 05:30:28 -08:00
Fabien Potencier
a27accf8e5 minor #21315 [DI][FrameworkBundle] Show autowired methods in descriptors (ogizanagi)
This PR was merged into the 3.3-dev branch.

Discussion
----------

[DI][FrameworkBundle] Show autowired methods in descriptors

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | N/A
| License       | MIT
| Doc PR        | N/A

so we can see the autowired methods using `debug:container`.

Commits
-------

482435c501 [DI][FrameworkBundle] Show autowired methods in descriptors
2017-02-16 05:25:28 -08:00
Fabien Potencier
3441b1586f bug #21436 [DependencyInjection] check for circular refs caused by method calls (xabbuh)
This PR was merged into the 2.7 branch.

Discussion
----------

[DependencyInjection] check for circular refs caused by method calls

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #19362
| License       | MIT
| Doc PR        |

Before we check for circular references, dependencies coming from method calls are not part of the dependency graph. That why the pass is not able to detect circular references like the one described in #19362 during compilation of the container.

If we add another check after all the optimisation passes have been processed, we should be able to detect these circular references too.

Commits
-------

fe4f7eccf7 check for circular refs caused by method calls
2017-02-16 05:23:11 -08:00
Fabien Potencier
d1f4cb27fd bug #21400 [Serializer] fix upper camel case conversion (see #21399) (markusu49)
This PR was merged into the 2.7 branch.

Discussion
----------

[Serializer] fix upper camel case conversion (see #21399)

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | ?
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #21399
| License       | MIT

Improve upper camel case support of CamelCaseToSnakeCaseConverter (`ThisIsATest` now converts to `this_is_a_test` instead of `_this_is_a_test`).

Commits
-------

81e771ca1a [Serializer] fix upper camel case conversion (see #21399)
2017-02-16 05:20:16 -08:00
Fabien Potencier
b056d40fb3 feature #21450 [Security] Lazy load guard authenticators and authentication providers (chalasr)
This PR was squashed before being merged into the 3.3-dev branch (closes #21450).

Discussion
----------

[Security] Lazy load guard authenticators and authentication providers

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | n/a
| License       | MIT
| Doc PR        | n/a

Authentication stops on the first authenticator that fails or succeeds, let's instantiate them only if actually needed.

Commits
-------

cd6422ae73 [SecurityBundle] Lazy load authentication providers
b8a23ded63 [Security][Guard] Lazy load authenticators
2017-02-16 04:58:04 -08:00
Fabien Potencier
7c9a5c1475 feature #21484 [DI] Deprecate underscore-services in YamlFileLoader (nicolas-grekas)
This PR was merged into the 3.3-dev branch.

Discussion
----------

[DI] Deprecate underscore-services in YamlFileLoader

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | yes
| Tests pass?   | no
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

As discussed when introducing `_defaults`

Commits
-------

7781082587 [DI] Deprecate underscore-services in YamlFileLoader
2017-02-16 04:51:31 -08:00
Fabien Potencier
be854e16d5 bug #21599 [Console][Table] fixed render when using multiple rowspans. (aitboudad)
This PR was merged into the 2.7 branch.

Discussion
----------

[Console][Table] fixed render when using multiple rowspans.

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #21018
| License       | MIT
| Doc PR        | ~

Commits
-------

17e459e688 [Console][Table] fixed render when using multiple rowspans.
2017-02-16 04:36:16 -08:00
Fabien Potencier
1901432c57 bug #21613 [Process] Permit empty suffix on Windows (Bilge)
This PR was submitted for the master branch but it was merged into the 2.7 branch instead (closes #21613).

Discussion
----------

[Process] Permit empty suffix on Windows

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        |

It is a fallacy to assume the blank suffix is not applicable on Windows systems, especially in a world where we often emulate Linux systems with solutions such as CYGWIN, MinGW and MSYS.

Commits
-------

412db4ca51 Permit empty suffix on Windows
2017-02-16 04:33:38 -08:00
Bilge
412db4ca51 Permit empty suffix on Windows 2017-02-16 04:33:37 -08:00
Fabien Potencier
a70ee67a88 minor #21615 [DI][FrameworkBundle] ServiceLocator: fix XmlDescriptor to use dashes (ogizanagi)
This PR was merged into the 3.3-dev branch.

Discussion
----------

[DI][FrameworkBundle] ServiceLocator: fix XmlDescriptor to use dashes

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | https://github.com/symfony/symfony/pull/21600#discussion_r101126540
| License       | MIT
| Doc PR        | N/A

As reported by @stof, I should have used dashes, not underscores. My bad...

Commits
-------

1417f112a7 [DI][FrameworkBundle] ServiceLocator: fix XML descriptor to use dashes
2017-02-16 04:32:11 -08:00
Fabien Potencier
5eabf64104 minor #21618 [FrameworkBundle] Remove unused import (dunglas)
This PR was merged into the 3.2 branch.

Discussion
----------

[FrameworkBundle] Remove unused import

| Q             | A
| ------------- | ---
| Branch?       | 3.2
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | n/a
| License       | MIT
| Doc PR        | n/a

Commits
-------

aa5d32b57b [FrameworkBundle] Remove unused import
2017-02-16 04:09:56 -08:00
Fabien Potencier
07bf70d90f fixed CS 2017-02-16 04:05:35 -08:00
Fabien Potencier
85ae59a15b minor #21536 [TwigBridge] Add docblocks for Twig url and path function to improve ide completion (Haehnchen)
This PR was merged into the 2.7 branch.

Discussion
----------

[TwigBridge] Add docblocks for Twig url and path function to improve ide completion

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| License       | MIT

`RoutingExtension` missed docblock for Twig extension so `path` and `url` are not fully recognized by PhpStorm.

https://github.com/Haehnchen/idea-php-symfony2-plugin/issues/864 will add more smarter completion
`{{ p<caret> }} -> {{ path('<caret>') }}`, but string parameter is not detected. This will add the minimal docs

Commits
-------

93ab0179f0 add docblocks for Twig url and path function to improve ide completion
2017-02-16 03:30:17 -08:00
Kévin Dunglas
aa5d32b57b
[FrameworkBundle] Remove unused import 2017-02-15 11:27:17 +01:00
Maxime Steinhausser
1417f112a7 [DI][FrameworkBundle] ServiceLocator: fix XML descriptor to use dashes 2017-02-14 23:21:16 +01:00
Abdellatif Ait boudad
17e459e688 [Console][Table] fixed render when using multiple rowspans. 2017-02-14 19:10:22 +00:00
Fabien Potencier
0976c86f3d minor #21600 [DI][FrameworkBundle] ServiceLocator: Tests dumpers & update descriptors (ogizanagi)
This PR was merged into the 3.3-dev branch.

Discussion
----------

[DI][FrameworkBundle] ServiceLocator: Tests dumpers & update descriptors

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | no
| Fixed tickets | N/A
| License       | MIT
| Doc PR        | N/A

This simply ensures the new feature is properly considered by the different dumpers, and updates the console descriptors to support the new `ServiceLocatorArgument`.

I also added the number of elements in an array/iterator/service_locator argument when using the `TextDescriptor` in this PR.

(fabbot is complaining about the new yaml tags support)

Commits
-------

aa9074d25a [DI][FrameworkBundle] ServiceLocator: Tests dumpers & update descriptors
2017-02-14 19:51:53 +01:00
Fabien Potencier
00d20ead28 feature #21270 [DependencyInjection] Use glob pattern to load config files (pierredup)
This PR was merged into the 3.3-dev branch.

Discussion
----------

[DependencyInjection] Use glob pattern to load config files

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #21173
| License       | MIT
| Doc PR        | -

This relates to #21173, but I'm not sure if it completely fixes the issue.

This allows to use a glob pattern to load config files, which makes the following possible:

```
# config.yml
imports:
    - { resource: "*.yml" }
    - { resource: "folder/*.yml" }
    - { resource: "/etc/myapp/*.{yml,xml}" }
```

It can also be used in a container extension, if a bundle uses a lot of configs:

```
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
$loader->load('*.yml');
$loader->load('routing/*');
```

Commits
-------

519180ef56 Use glob pattern to load config file
2017-02-14 19:46:56 +01:00
Fabien Potencier
1079668d4b feature #19815 [WebProfilerBundle] Make the IP address in the profiler header clickable (jameshalsall)
This PR was merged into the 3.3-dev branch.

Discussion
----------

[WebProfilerBundle] Make the IP address in the profiler header clickable

| Q | A |
| --- | --- |
| Branch? | master |
| Bug fix? | no |
| New feature? | yes |
| BC breaks? | no |
| Deprecations? | no |
| Tests pass? | yes |
| License | MIT |

Commits
-------

52606a19cf [WebProfilerBundle] Make the IP address in the profiler header clickable to view requests by IP
2017-02-14 19:35:04 +01:00
Fabien Potencier
be691d5e70 minor #21028 [Console] Updated phpdoc on return types (mlpo)
This PR was merged into the 2.7 branch.

Discussion
----------

[Console] Updated phpdoc on return types

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | n/a
| License       | MIT
| Doc PR        | n/a

The return type of “ask” is not necessarily a string (notice that “doAsk” may return mixed type).
Same for “validateAttempts” (validator may return something else than a string).

Commits
-------

442a304292 [Console] Updated phpdoc on return types
2017-02-14 19:34:00 +01:00
Fabien Potencier
ff75e32e45 bug #21057 [DI] Auto register extension configuration classes as a resource (ro0NL)
This PR was merged into the 2.7 branch.

Discussion
----------

[DI] Auto register extension configuration classes as a resource

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #... <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | symfony/symfony-docs#... <!--highly recommended for new features-->

Auto-register an extension configuration class as a resource from a compiler pass; not implicitly by the base extension class.

Causing some extensions to register its configuration, whereas others dont (e.g. framework bundle).

Fixes consistent cache invalidation whenever a configuration definition changes.

Commits
-------

142416b7d4 [DI] Auto register extension configuration classes as a resource
2017-02-14 19:31:46 +01:00
Nicolas Grekas
db995dfaf8 Merge branch '3.2'
* 3.2: (27 commits)
  Improve tracking of environment variables in the case of private services
  [DI] Align AutowirePass with 2.8
  property constraints can be added in child classes
  added test for staticClassLoader in LazyLoadingMetadatafactory
  fixed PHPUnit setUp and tearDown method visibility
  spelling fixes
  Readd Symfony version status in the toolbar
  [Security] LdapUserProvider should not throw an exception if the UID key does not exist in an LDAP entry
  make sure that null can be the invalid value
  [VarDumper] Improve dump of AMQP* Object
  Fix annotations cache folder path
  [FrameworkBundle] Wire ArrayCache for annotation reader at bootstrap
  Ignore missing 'debug.file_link_formatter' service in Debug bundle
  [VarDumper] Fixed dumping of terminated generator
  bumped Symfony version to 3.2.4
  updated VERSION for 3.2.3
  updated CHANGELOG for 3.2.3
  bumped Symfony version to 2.8.18
  updated VERSION for 2.8.17
  updated CHANGELOG for 2.8.17
  ...
2017-02-14 17:35:24 +01:00
Nicolas Grekas
975411d7f0 Merge branch '2.8' into 3.2
* 2.8:
  property constraints can be added in child classes
  added test for staticClassLoader in LazyLoadingMetadatafactory
  spelling fixes
  Readd Symfony version status in the toolbar
  make sure that null can be the invalid value
  [VarDumper] Improve dump of AMQP* Object
  [VarDumper] Fixed dumping of terminated generator
  bumped Symfony version to 2.8.18
  updated VERSION for 2.8.17
  updated CHANGELOG for 2.8.17
  bumped Symfony version to 2.7.25
  updated VERSION for 2.7.24
  update CONTRIBUTORS for 2.7.24
  updated CHANGELOG for 2.7.24
  [FrameworkBundle] Simplify createPackageDefinition
  fix directory resource considers same timestamp not fresh
  return false early from directory resource
2017-02-14 17:27:43 +01:00
Nicolas Grekas
03194300ed Merge branch '2.7' into 2.8
* 2.7:
  property constraints can be added in child classes
  added test for staticClassLoader in LazyLoadingMetadatafactory
  spelling fixes
  make sure that null can be the invalid value
  bumped Symfony version to 2.7.25
  updated VERSION for 2.7.24
  update CONTRIBUTORS for 2.7.24
  updated CHANGELOG for 2.7.24
  [FrameworkBundle] Simplify createPackageDefinition
  fix directory resource considers same timestamp not fresh
  return false early from directory resource
2017-02-14 17:24:56 +01:00
Maxime Steinhausser
482435c501 [DI][FrameworkBundle] Show autowired methods in descriptors 2017-02-14 15:26:51 +01:00
Nicolas Grekas
298060d0a0 minor #21529 [FrameworkBundle] Simplify createPackageDefinition (dunglas)
This PR was merged into the 2.7 branch.

Discussion
----------

[FrameworkBundle] Simplify createPackageDefinition

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #... <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | n/a

Minor simplification.

Commits
-------

4b81393 [FrameworkBundle] Simplify createPackageDefinition
2017-02-14 13:45:10 +01:00
Nicolas Grekas
28a3524a0e minor #21605 [DI] Align AutowirePass with 2.8 (nicolas-grekas)
This PR was merged into the 3.2 branch.

Discussion
----------

[DI] Align AutowirePass with 2.8

| Q             | A
| ------------- | ---
| Branch?       | 3.2
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Follow up a less than ideal [merge conflict resolution](https://github.com/symfony/symfony/pull/18691#issuecomment-218803903), found while reviewing AutowirePass in 2.8 and 3.2 and wondering about the delta. Should reduce future merge conflicts and help history tracking.

Commits
-------

dd5236a [DI] Align AutowirePass with 2.8
2017-02-14 13:24:27 +01:00
Nicolas Grekas
0b46a1b20c bug #21607 Improve tracking of environment variables in the case of private services (tgalopin)
This PR was merged into the 3.2 branch.

Discussion
----------

Improve tracking of environment variables in the case of private services

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #21273
| License       | MIT

Recently, I stumbled upon an issue with environment variables that I had troubles to understand. Here it is:

I have two environment variables, defined in my `parameters.yml` with a default value of empty:

``` yaml
parameters:
    env(MAILJET_PUBLIC_KEY): ''
    env(MAILJET_PRIVATE_KEY): ''
```

I use these variables only in a private service:

``` xml
<service id="app.mailjet.transport" class="AppBundle\Mailjet\MailjetApiTransport" public="false">
    <argument type="service" id="csa_guzzle.client.mailjet_api"/>
    <argument>%env(MAILJET_PUBLIC_KEY)%</argument>
    <argument>%env(MAILJET_PRIVATE_KEY)%</argument>
</service>
```

This private service is not used by any other service for the moment.

As the service is private and not used by any other service, the `RemoveUnusedDefinitionsPass` removes it from the container. However, when the container dumper dumps the container, it checks if the environment variable was dumped. As the service is now gone, an expection is thrown (`EnvParameterException, Incompatible use of dynamic environment variables "MAILJET_PUBLIC_KEY", "MAILJET_PRIVATE_KEY" found in parameters.`).

Commits
-------

f380ba3 Improve tracking of environment variables in the case of private services
2017-02-14 13:23:27 +01:00
Titouan Galopin
f380ba3770 Improve tracking of environment variables in the case of private services 2017-02-14 12:44:34 +01:00
Nicolas Grekas
dd5236ad97 [DI] Align AutowirePass with 2.8 2017-02-14 10:20:20 +01:00
Pierre du Plessis
519180ef56 Use glob pattern to load config file 2017-02-14 07:56:25 +02:00
Maxime Steinhausser
aa9074d25a [DI][FrameworkBundle] ServiceLocator: Tests dumpers & update descriptors 2017-02-13 20:22:27 +01:00
Fabien Potencier
5c07ffada7 bug #21592 [Validator] property constraints can be added in child classes (angelk, xabbuh)
This PR was merged into the 2.7 branch.

Discussion
----------

[Validator] property constraints can be added in child classes

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #21538, #21567
| License       | MIT
| Doc PR        |

This reverts the changes done in #21053 (and applies the test written by @angelk in #21538). I think trying to "fix" #15950 with the changes from #21053 was a mistake. Child classes should be able to refine validation constraints (I basically agree with @ro0NL's reasoning in https://github.com/symfony/symfony/issues/21567#issuecomment-278729990.

Commits
-------

9513a8aa52 property constraints can be added in child classes
a266ff799c added test for staticClassLoader in LazyLoadingMetadatafactory
2017-02-13 19:48:02 +01:00
Fabien Potencier
43588ca288 minor #21594 fixed PHPUnit setUp and tearDown method visibility (fabpot)
This PR was merged into the 3.2 branch.

Discussion
----------

fixed PHPUnit setUp and tearDown method visibility

| Q             | A
| ------------- | ---
| Branch?       | 3.2
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | n/a
| License       | MIT
| Doc PR        | n/a

Commits
-------

4fd4cb900b fixed PHPUnit setUp and tearDown method visibility
2017-02-13 18:40:29 +01:00
Christian Flothmann
9513a8aa52 property constraints can be added in child classes 2017-02-13 18:37:45 +01:00
po_taka
a266ff799c added test for staticClassLoader in LazyLoadingMetadatafactory 2017-02-13 18:37:45 +01:00
Kévin Dunglas
b5d9b3b99e
[Serializer] Pass the context to AbstractObjectNormalizer::supportsDenormalization 2017-02-13 15:50:04 +01:00
Fabien Potencier
9ac3a7e010 feature #21383 [DependencyInjection] Add support for named arguments (dunglas, nicolas-grekas)
This PR was merged into the 3.3-dev branch.

Discussion
----------

[DependencyInjection] Add support for named arguments

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | yes
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | todo

This PR introduces named arguments for services definitions. It's especially useful to inject parameters in an autowired service. It is (at least partially) an alternative to #21376 and #20738.

Usage:

```yml
services:
    _defaults: { autowire: true }
    Acme\NewsletterManager: { $apiKey: "%mandrill_api_key%" }

# Alternative (traditional) syntax
services:
    newsletter_manager:
        class: Acme\NewsletterManager
        arguments:
            $apiKey: "%mandrill_api_key%"
        autowire: true
```
```php
use Doctrine\ORM\EntityManager;
use Psr\Log\LoggerInterface;

namespace Acme;

class NewsletterManager
{
    private $logger;
    private $em;
    private $apiKey;

    public function __construct(LoggerInterface $logger, EntityManager $em, $apiKey)
    {
        $this->logger = $logger;
        $this->em = $em;
        $this->apiKey = $apiKey;
    }
}
```

Commits
-------

8a126c8537 [DI] Deprecate string keys in arguments
2ce36a6074 [DependencyInjection] Add a new pass to check arguments validity
6e501296f9 [DependencyInjection] Add support for named arguments
2017-02-13 15:38:11 +01:00
Fabien Potencier
17b43632b5 feature #19371 [Serializer] Give access to the context to support* methods (dunglas)
This PR was squashed before being merged into the 3.3-dev branch (closes #19371).

Discussion
----------

[Serializer] Give access to the context to support* methods

| Q | A |
| --- | --- |
| Branch? | master |
| Bug fix? | no (?) |
| New feature? | yes |
| BC breaks? | no |
| Deprecations? | no |
| Tests pass? | yes |
| Fixed tickets | - |
| License | MIT |
| Doc PR | n/a |

This is a current use case to want to access the context form the `supports*` methods. This PR fixes this limitation.

Maybe can it be considered a bug fix?

Commits
-------

6a7a16e517 [Serializer] Give access to the context to support* methods
2017-02-13 15:29:04 +01:00
Kévin Dunglas
6a7a16e517 [Serializer] Give access to the context to support* methods 2017-02-13 15:28:10 +01:00
Fabien Potencier
320529e646 feature #21553 [DI] Replace container injection by explicit service locators (chalasr)
This PR was merged into the 3.3-dev branch.

Discussion
----------

[DI] Replace container injection by explicit service locators

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #20658
| License       | MIT
| Doc PR        | https://github.com/symfony/symfony-docs/pull/7458

This adds a new `ServiceLocatorArgument` (`!service_locator`) argument type which takes a list of services, meant to be used as a concrete service locator in order to avoid the remaining needs for injecting the container when it's only a matter of dependency lazy-loading.

Config:
```yaml
App\FooBar: [!service_locator { key1: '@service1', key2: '@service2' }]
```

```xml
<service class="App\FooBar" public="false">
    <argument type="service-locator">
        <argument type="service" key="key1" id="service1"/>
        <argument type="service" key="key2" id="service2"/>
     </argument>
</service>
```

```php
new ServiceLocatorArgument(array('key1' => new Reference('service1'), 'key2' => new Reference('service2'));
```

Usage:
```php
$locator->has('key1') // true
$locator->has('service1') // false, the defined key must be used
$locator->get('key1'); // service1 instance
$locator->get('service1'); // exception
$locator->has('not-specified') // false
$locator->get('not-specified'); // exception
```

We have some concrete use cases in the core where this would be useful (see e.g. SecurityBundle's FirewallMap), same in userland/3rd party code (see related RFC).

Commits
-------

e7935c0adb [DI] Replace container injection by explicit service locators
2017-02-13 15:17:30 +01:00
Fabien Potencier
e43bd57508 feature #18834 [Serializer] Add the possibility to filter attributes (dunglas)
This PR was merged into the 3.3-dev branch.

Discussion
----------

[Serializer] Add the possibility to filter attributes

| Q | A |
| --- | --- |
| Branch? | master |
| Bug fix? | no |
| New feature? | yes |
| BC breaks? | no |
| Deprecations? | no |
| Tests pass? | yes |
| Fixed tickets | n/a |
| License | MIT |
| Doc PR | todo |

This new features give the possibility to the end user to select select fields to normalize.

Exemple:

``` php
class Foo
{
    public $a = '1';
    public $b = '2';
    public $c = '3';
}

$normalizer = new \Symfony\Component\Serializer\Normalizer\ObjectNormalizer();
$normalizer->normalize(new Foo(), null, ['attributes' => ['a', 'c']]);
// ['a' => '1', 'c' => '3']
```

Denormalization is also supported. This feature works for any normalizer using the `Symfony\Component\Serializer\Normalizer\AbstractNormalizer` class.

The main use case is to permit to API clients to optimize responses length by dropping unnecessary information like in the following example:

```
http://exemple.com/cars?fields=a,c

{'a' => 1, 'c' => 2}
```

Thanks to this PR, support for this feature will be available out of the box in [API Platform](https://api-platform.com).

Commits
-------

b3826fb0e7 [Serializer] Add the possibility to filter attributes
2017-02-13 15:11:55 +01:00