Commit Graph

7960 Commits

Author SHA1 Message Date
Fabien Potencier
cee0136acf feature #21979 [FrameworkBundle][TwigBundle] Require PSR-11 container instead of Symfony container (enumag)
This PR was merged into the 3.3-dev branch.

Discussion
----------

[FrameworkBundle][TwigBundle] Require PSR-11 container instead of Symfony container

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

As discussed in #21978 here is the second PR.

Commits
-------

857ce7c7be [FrameworkBundle][TwigBundle] Require PSR-11 container instead of Symfony container
2017-03-14 14:32:46 -07:00
Jáchym Toušek
857ce7c7be
[FrameworkBundle][TwigBundle] Require PSR-11 container instead of Symfony container 2017-03-14 22:27:21 +01:00
Fabien Potencier
d1e591edd8 feature #21935 [FrameworkBundle][Workflow] Add a way to register a guard expression in the configuration (lyrixx)
This PR was merged into the 3.3-dev branch.

Discussion
----------

[FrameworkBundle][Workflow] Add a way to register a guard expression in the configuration

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

---

Many people already asked for this feature so ... here we go 🎉

---

Usage:
```yml
            transitions:
                journalist_approval:
                    guard: "is_fully_authenticated() and has_role('ROLE_JOURNALIST') or is_granted('POST_EDIT', subject)"
                    from: wait_for_journalist
                    to: approved_by_journalist
                publish:
                    guard: "subject.isPublic()"
                    from: approved_by_journalist
                    to: published
```

Commits
-------

ab3b12d6dc [FrameworkBundle][Workflow] Add a way to register a guard expression in the configuration
2017-03-14 12:04:20 -07:00
Fabien Potencier
6166260d6e feature #21080 [FrameworkBundle][Monolog] Added a new way to follow logs (lyrixx)
This PR was merged into the 3.3-dev branch.

Discussion
----------

[FrameworkBundle][Monolog] Added a new way to follow logs

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

----

If you want to try this PR, you can use [my fork](https://github.com/lyrixx/symfony-standard/tree/server-log):
```bash
git clone https://github.com/lyrixx/symfony-standard -b server-log symfony-se-logs
cd symfony-se-logs
composer install
bin/console server:start
bin/console server:log
```
and from anywhere `curl http://0:8000`

---

Basically, it's a new way to view and filter real time logs, from the CLI.

![screenshot13](https://cloud.githubusercontent.com/assets/408368/21898198/52fa8c3c-d8ec-11e6-98db-6b3a6f8fe50d.png)

Commits
-------

ac92375ddb [FrameworkBundle][Monolog] Added a new way to follow logs
2017-03-14 11:58:53 -07:00
Nicolas Grekas
27dbfda18e Merge branch '3.2'
* 3.2:
  [FrameworkBundle] Fix cleaning of test dirs
2017-03-14 08:58:07 +01:00
Nicolas Grekas
efa74c5eab Merge branch '2.8' into 3.2
* 2.8:
  [FrameworkBundle] Fix cleaning of test dirs
2017-03-14 08:56:22 +01:00
Nicolas Grekas
6b4cfd6a25 Merge branch '2.7' into 2.8
* 2.7:
  [FrameworkBundle] Fix cleaning of test dirs
2017-03-14 08:55:42 +01:00
Nicolas Grekas
4842c86324 [FrameworkBundle] Fix cleaning of test dirs 2017-03-13 22:39:55 +01:00
Nicolas Grekas
dc52a3f85c Merge branch '3.2'
* 3.2:
  [VarDumper] Add missing isset() checks in some casters
  [VarDumper] Add missing isset() checks in some casters
  [Form] Choice type int values (BC Fix)
  bumped Symfony version to 3.2.7
  updated VERSION for 3.2.6
  updated CHANGELOG for 3.2.6
  Use PHPUnit 5.4 instead of 5.3
  [PropertyAccess] Use ArrayAdapter in debug mode
  bumped Symfony version to 3.2.6
  updated VERSION for 3.2.5
  updated CHANGELOG for 3.2.5
  cached files rely on umask
2017-03-12 16:46:41 +01:00
Grégoire Pineau
ab3b12d6dc [FrameworkBundle][Workflow] Add a way to register a guard expression in the configuration 2017-03-10 11:19:28 +01:00
Grégoire Pineau
b385ef1625 feature #21933 [FrameworkBundle][Workflow] Add a way to enable the AuditTrail Logger (lyrixx)
This PR was squashed before being merged into the 3.3-dev branch (closes #21933).

Discussion
----------

[FrameworkBundle][Workflow] Add a way to enable the AuditTrail Logger

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

---

This will increase the visibility of the Listener. We could encourage people to use at least  `%kernel.debug%` value.

---

Note for the merge: There are two commits, this is done on purpose (2 different things, but easier to do only one PR)

Commits
-------

633c0393b3 [Workflow] Added the workflow name in log generated by AuditTrailListener
b786bccb3a [FrameworkBundle][Workflow] Add a way to enable the AuditTrail Logger
2017-03-10 10:44:46 +01:00
Nicolas Grekas
64f9f7b193 bug #21927 [FrameworkBundle] Add missing resource tracking for validation mapping (chalasr)
This PR was merged into the 3.3-dev branch.

Discussion
----------

[FrameworkBundle] Add missing resource tracking for validation mapping

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

https://github.com/symfony/symfony/pull/21927/files?w=1

Commits
-------

0a19cbe Add missing resource tracking for validation mapping
2017-03-09 11:46:22 +01:00
Robin Chalas
0a19cbe906 Add missing resource tracking for validation mapping 2017-03-09 11:23:13 +01:00
Nicolas Grekas
24f36b6c44 bug #21936 [PropertyAccess] Use ArrayAdapter in debug mode (chalasr)
This PR was merged into the 3.2 branch.

Discussion
----------

[PropertyAccess] Use ArrayAdapter in debug mode

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

https://github.com/symfony/symfony/pull/21936/files?w=1

Commits
-------

dca3f36 [PropertyAccess] Use ArrayAdapter in debug mode
2017-03-09 11:20:43 +01:00
Robin Chalas
dca3f365d7 [PropertyAccess] Use ArrayAdapter in debug mode 2017-03-09 10:04:18 +01:00
Fabien Potencier
7f6f402fad Merge branch '3.2'
* 3.2:
  [Workflow] Delete dead code
  Rename StackOverflow to Stack Overflow
  [travis] Test with hhvm 3.18
  [Workflow] Fixed marking state on leave and enter events
2017-03-08 17:48:13 -08:00
Fabien Potencier
575b7987bf Merge branch '2.8' into 3.2
* 2.8:
  Rename StackOverflow to Stack Overflow
  [travis] Test with hhvm 3.18
2017-03-08 17:47:54 -08:00
Fabien Potencier
25a2ce062b Merge branch '2.7' into 2.8
* 2.7:
  Rename StackOverflow to Stack Overflow
  [travis] Test with hhvm 3.18
2017-03-08 17:47:20 -08:00
Grégoire Pineau
b786bccb3a [FrameworkBundle][Workflow] Add a way to enable the AuditTrail Logger 2017-03-08 17:21:33 +01:00
Nicolas Grekas
7f1f0cb630 [travis] Test with hhvm 3.18 2017-03-08 10:42:29 +01:00
Nicolas Grekas
414ac5d976 [FrameworkBundle] Fix autoloader in insulated clients 2017-03-08 10:00:17 +01:00
Grégoire Pineau
ac92375ddb [FrameworkBundle][Monolog] Added a new way to follow logs 2017-03-07 13:44:48 +01:00
Fabien Potencier
c6e1a49731 feature #21770 [DI] Allow extensions to create ServiceLocator as services (nicolas-grekas)
This PR was merged into the 3.3-dev branch.

Discussion
----------

[DI] Allow extensions to create ServiceLocator as services

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

https://github.com/symfony/symfony/pull/21770/files?w=1

With this PR, DI extensions are able to create "service locator" services.
They are easily created as such:
```php
$container->register('my_service_locator', ServiceLocator::class)
    ->addArgument(array(
        'exposed_id' => new ServiceClosureArgument(new Reference('internal_id')),
    ))
```
I already need this in two different PRs to come.

Commits
-------

1d9663326e [DI] Allow creating ServiceLocator-based services in extensions
2017-03-05 12:01:09 -08:00
Fabien Potencier
0db972355b feature #21767 [DI][Router][DX] Invalidate routing cache when container parameters changed (ogizanagi)
This PR was merged into the 3.3-dev branch.

Discussion
----------

[DI][Router][DX] Invalidate routing cache when container parameters changed

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

Supersedes #21443 but only for master.

Indeed, this implementation uses a new feature: a `ContainerParametersResource` which compares cached containers parameters (collected at some point, here by the `Router`) with current ones in the container.

On the contrary of the previous PR targeting 2.7, this will only invalidate routing cache when parameters actually used in the routes changed and will avoid always rebuilding the routing cache when the container is rebuilt, just to catch the edge case of someone modifying a parameter.

Commits
-------

fad4d9e2ef [DI][Router][DX] Invalidate routing cache when container parameters changed
2017-03-05 11:44:35 -08:00
Maxime Steinhausser
fad4d9e2ef [DI][Router][DX] Invalidate routing cache when container parameters changed 2017-03-05 20:24:24 +01:00
Robin Chalas
32be16b239 Move RoutingResolverPass to the Routing component 2017-03-05 16:12:05 +01:00
Nicolas Grekas
1d9663326e [DI] Allow creating ServiceLocator-based services in extensions 2017-03-05 14:36:05 +01:00
Robin Chalas
8bad8a109c Move ControllerArgumentValueResolverPass to the HttpKernel component 2017-03-03 13:55:06 +01:00
Christian Flothmann
fdfcb220e5 [FrameworkBundle] fix a minor typo 2017-03-03 09:31:18 +01:00
Fabien Potencier
1a957100c2 Merge branch '3.2'
* 3.2:
  [Config] removed obsolete code
  [Form] Improve rounding precision
  [Routing] Ignore hidden directories when loading routes from annotations
  fixed CS
2017-03-02 13:35:04 -08:00
Fabien Potencier
86675f3faa Merge branch '2.8' into 3.2
* 2.8:
  fixed CS
2017-03-02 13:34:34 -08:00
Fabien Potencier
a19e3fe970 Merge branch '2.7' into 2.8
* 2.7:
  fixed CS
2017-03-02 13:33:27 -08:00
Kévin Dunglas
1f2521e347 [FrameworkBundle] Introduce autowirable ControllerTrait 2017-03-02 12:20:19 -08:00
Fabien Potencier
3fa8a0571d feature #21763 [DI] Replace wildcard-based methods autowiring by @required annotation (nicolas-grekas)
This PR was squashed before being merged into the 3.3-dev branch (closes #21763).

Discussion
----------

[DI] Replace wildcard-based methods autowiring by `@required` annotation

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no (affects things that are only on master)
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

While playing a bit with new features in master around DI configuration, several people around me got bitten by wildcard-based autowiring. The typical example is adding `autowire: [set*]` in `_defaults`: use that on `resource: ../src/Command/` PSR4-based loading and boom, `setApplication` and `setHelperSet` will now be wrongly called. You could tell me "of course, don't to that" - but being bitten so early on a master-only feature makes me really unconfident that this will be easy enough for people after the release.

If wildcard-based autowiring is removed, then I don't see anymore the need for allowing arrays as in `autowire: [setFoo,getBar]`. Moreover, this array syntax has a core DX issue: it's a dead end as far as the learning curve is concerned. You learn it, then when becoming a more advanced dev, someone teaches you that you'd better use another syntax: explicit wiring.

And in fact, we don't need it at all, because something else already exists: just declare a method call, but don't define its arguments. If `autowire: true` is set, then the AutowiringPass already fills in the holes. There is only one tweak required to make this work: don't autowire optional arguments for method calls - or that'd be a BC break. To my PoV that's even better: this makes autowiring fit a "do the minimum to make it work" strategy. A really good one to me.

But there is still an issue: wildcard-based autowiring fits a need. Namely, it allows one to define a convention (eg. `'set*'`), and have all such methods that follow the convention be autowired. To me, this looks like doing it reverse (the DI config should adapt to the code, not reverse). So, to fill this need, let the declaration be in the source: just use an annotation!

This PR adds support for the `@required` annotation, borrowed from the Spring framework:
https://www.tutorialspoint.com/spring/spring_required_annotation.htm

Using the annotation is totally optional of course. If you do, *and if autowiring is on*, then it'll be autowired. If you don't, nothing changes: do manual wiring.

Even when not using autowiring, the annotation is still a nice hint for the consumer of your classes: it tells the reader that this method needs to be called for correct instantiation - thus lowering one drawback of setter injection (discoverability).

The implementation of the annotation parsing is done using a few regexp (no dep on any complex parser) - and works with inheritance, by leveraging the `@inheritdoc` tag (the default behavior being to *not* inherit anything from parent methods).

All in all, looking at the diff stats, it makes everything simpler. Good sign, isn't it?

Commits
-------

f286fcc25f [DI] Replace wildcard-based methods autowiring by `@required` annotation
9081699980 Revert "minor #21315 [DI][FrameworkBundle] Show autowired methods in descriptors (ogizanagi)"
2017-03-01 12:47:24 -08:00
Fabien Potencier
ad0bb6ac53 fixed CS 2017-03-01 11:43:24 -08:00
Fabien Potencier
8d99d5758a Merge branch '3.2'
* 3.2:
  fixed tests
  fixed tests
  revert typo fix
  [Form] Fix ChoiceType to ensure submitted data is not nested unnecessarily
  Fix phpstorm helper to the official format
  Test inline styles with non-decorated formatter
  Fix RuntimeException when an Emacs buffer is modified
  [Yaml] add tests for specific mapping keys
2017-03-01 10:19:35 -08:00
Robin Chalas
8ba1412cdd Fix broken AddConstraintValidatorsPassTest 2017-03-01 18:23:13 +01:00
Guilhem Niot
597b6bcab6 [DependencyInjection] Use a service locator in AddConstraintValidatorsPass 2017-03-01 08:17:18 -08:00
Fabien Potencier
7f27787dd0 bug #21811 Revert "[SecurityBundle] only pass relevant user provider" (xabbuh)
This PR was merged into the 3.3-dev branch.

Discussion
----------

Revert "[SecurityBundle] only pass relevant user provider"

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

This reverts commit d97e07fd6a (applies #21798 on `master`). There is no merge commit that could be reverted.

Commits
-------

5b016cef7b Revert "[SecurityBundle] only pass relevant user provider"
2017-03-01 07:33:13 -08:00
Fabien Potencier
891f4e7311 bug #21813 Update phpstorm helper to the official format (pierredup)
This PR was merged into the 3.2 branch.

Discussion
----------

Update phpstorm helper to the official format

| Q             | A
| ------------- | ---
| Branch?       | 3.2 <!--see comment below-->
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | N/A
| License       | MIT
| Doc PR        | N/A

Commits
-------

eb09d7cc2e Fix phpstorm helper to the official format
2017-03-01 06:55:48 -08:00
Pierre du Plessis
eb09d7cc2e Fix phpstorm helper to the official format 2017-03-01 16:46:28 +02:00
Christian Flothmann
5b016cef7b Revert "[SecurityBundle] only pass relevant user provider"
This reverts commit d97e07fd6a.
2017-03-01 14:05:00 +01:00
Robin Chalas
7a7ff24a43 Move PropertyInfoPass to the PropertyInfo component 2017-03-01 09:44:14 +01:00
Fabien Potencier
526d396ccd bug #21627 [DependencyInjection] make the service container builder register its own self referencing definition (hhamon)
This PR was merged into the 3.3-dev branch.

Discussion
----------

[DependencyInjection] make the service container builder register its own self referencing definition

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

Commits
-------

9c97496b5f [DependencyInjection] make the service container builder register the definition of its related service container service (and aliases) in order to make compiler passes be able to reference the special service_container service.
2017-02-28 14:49:08 -08:00
Fabien Potencier
2353a34180 feature #21768 [HttpKernel] Add a ContainerControllerResolver (psr-11) (ogizanagi)
This PR was merged into the 3.3-dev branch.

Discussion
----------

[HttpKernel] Add a ContainerControllerResolver (psr-11)

| 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

Extracts the controller as service resolution from the framework bundle controller resolver in a `Symfony/Component/HttpKernel/Controller/Psr11ControllerResolver`, allowing you to use `HttpKernel` with your own psr-11 container.

Commits
-------

7bbae4159b [HttpKernel] Add a ContainerControllerResolver (psr-11)
2017-02-28 12:45:21 -08:00
Maxime Steinhausser
7bbae4159b [HttpKernel] Add a ContainerControllerResolver (psr-11) 2017-02-28 21:33:09 +01:00
Fabien Potencier
d1da474f8d feature #21690 [Form] allow form types + form type extensions + form type guessers to be private services (hhamon)
This PR was merged into the 3.3-dev branch.

Discussion
----------

[Form] allow form types + form type extensions + form type guessers to be private services

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

This pull request is about making internal form services (aka form types, form type extensions and form type guessers) private. They used to be public until Symfony 3.2 for one valid reason: lazyness. However, Symfony 3.3 now comes with built-in mechanism to support effective lazy loading of private services with service locators and proxies.

This PR makes the `DependencyInjectionExtension` class of the `Form` component leverage these new DI component mechanisms. Form types, form type extensions and form type guessers can now be declared private as a best practice. We decided to make these services private as of Symfony 3.3 and of course it would break BC. But this PR introduces a BC layer using a Symfony trick to keep internal form services public. The service container currently has a known issue where private services are not really private if they're referenced by at least two other services in the container. We use this trick to maintain the legacy services public even though the new API relies on private ones. This trick is done thanks to the `deprecated.form.registry` and `deprecated.form.registry.csrf` fake services that will be removed in Symfony 4.0.

Commits
-------

600e75ce88 [Form] use new service locator in DependencyInjectionExtension class, so that form types can be made private at some point.
2017-02-28 12:26:30 -08:00
Maxime Steinhausser
5a24ee2da1 [Config][FrameworkBundle] Lazy load resource checkers 2017-02-28 18:07:25 +01:00
Fabien Potencier
41fd5d1286 feature #21375 [FrameworkBundle][Config] Move ConfigCachePass from FrameworkBundle to Config (Deamon)
This PR was merged into the 3.3-dev branch.

Discussion
----------

[FrameworkBundle][Config] Move ConfigCachePass from FrameworkBundle to Config

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

This MR is part of the #21284 todo list
<!--
- Bug fixes must be submitted against the lowest branch where they apply
  (lowest branches are regularly merged to upper ones so they get the fixes too).
- Features and deprecations must be submitted against the master branch.
- Please fill in this template according to the PR you're about to submit.
- Replace this comment by a description of what your PR is solving.
-->

Commits
-------

bce445f452 Move ConfigCachePass from FrameworkBundle to Config
2017-02-28 08:10:35 -08:00
Nicolas Grekas
3729a157b9 bug #21803 [master] Fix issues reported by static analyse (romainneutron)
This PR was merged into the 3.3-dev branch.

Discussion
----------

[master] Fix issues reported by static analyse

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

Follow-up #21802

Commits
-------

671694d [master] Fix issues reported by static analyse
2017-02-28 16:52:13 +01:00