Commit Graph

35006 Commits

Author SHA1 Message Date
Nicolas Grekas
520cc97e18 [HttpKernel] remove noisy frame in controller stack traces 2017-12-07 19:55:09 +01:00
Fabien Potencier
05ffb6f726 bug #25325 [Yaml] do not evaluate PHP constant names (xabbuh)
This PR was merged into the 3.4 branch.

Discussion
----------

[Yaml] do not evaluate PHP constant names

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

PHP constant identifiers must be strings anyway. Thus, we only need to
parse quoted strings, but do not have to evaluate the data types.

Commits
-------

956287be72 do not evaluate PHP constant names
2017-12-07 10:43:53 -08:00
Fabien Potencier
5d7576cf84 minor #25299 [Serializer] improved CsvEncoder::decode performance (Roman Orlov)
This PR was merged into the 3.4 branch.

Discussion
----------

[Serializer] improved CsvEncoder::decode performance

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

Improved CsvEncoder::decode performance by caching duplicate count calls.
Blackfire profiles before and after change tested on collection of 10000 elements:
[before] https://blackfire.io/profiles/9c08f789-cd29-4eae-92c8-046e3849a2b8/graph
[after] https://blackfire.io/profiles/a17bfb6b-ef82-41ee-9edd-9403f829d6ab/graph

Commits
-------

3b910a9fad [Serializer] improved CsvEncoder::decode performance by caching duplicate count calls
2017-12-07 10:36:42 -08:00
Fabien Potencier
279dc46756 feature #24375 [Serializer] Serialize and deserialize from abstract classes (sroze)
This PR was squashed before being merged into the 4.1-dev branch (closes #24375).

Discussion
----------

[Serializer] Serialize and deserialize from abstract classes

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

This PR adds a feature in the Serializer: allow to serialize and de-serialize abstract classes. Such feature is especially useful when dealing with domain objects.

# Example

Let's take the example of the following objects:
- `CodeRepository` defines a set of properties like `name` and `url`
- `GitHubCodeRepository` and `BitBucketCodeRepository` extends from the abstract `CodeRepository` class and adds a few properties.
- `Project` has a relation with a `codeRepository`, which has a type `CodeRepository`.

At the moment, the serializer can't serialize/deserialize correctly this `Project` object has it doesn't know how to deal with this `CodeRepository` abstract object.

This feature allows the serializer to deal with such situation. The `ObjectNormalizer` has now access to a `ClassDiscriminatorResolver` that knows, for a given abstract class:
- Is the "type" property it needs to read/write to uniquely identify each sub-class
- What's the name of the "type" for each sub-class mapping

# Usage without Framework Bundle

```php
$discriminatorResolver = new ClassDiscriminatorResolver();
$discriminatorResolver->addClassMapping(CodeRepository::class, new ClassDiscriminatorMapping('type', [
    'github' => GitHubCodeRepository::class,
    'bitbucket' => BitBucketCodeRepository::class,
]));

$serializer = new Serializer(array(new ObjectNormalizer(null, null, null, null, $discriminatorResolver)), array('json' => new JsonEncoder()));

$serialized = $serializer->serialize(new GitHubCodeRepository());
// {"type": "github"}

$repository = $serializer->unserialize($serialized, CodeRepository::class, 'json');
// GitHubCodeRepository

```

# Usage with the Framework Bundle

```yaml
framework:
    serializer:
        discriminator_class_mapping:
            App\CodeRepository:
                 type_property: type
                 mapping:
                    github: App\GitHubCodeRepository
                    bitbucket: App\BitBucketCodeRepository
```

# Usage with Annotations/XML/YAML

```php
use Symfony\Component\Serializer\Annotation\DiscriminatorMap;

/**
 * @DiscriminatorMap(typeProperty="type", mapping={
 *    "first"="Symfony\Component\Serializer\Tests\Fixtures\AbstractDummyFirstChild",
 *    "second"="Symfony\Component\Serializer\Tests\Fixtures\AbstractDummySecondChild"
 * })
 */
abstract class AbstractDummy
{
    public $foo;

    public function __construct($foo = null)
    {
        $this->foo = $foo;
    }
}
```

# TODO

- [x] Working as standalone
- [x] Working with the framework bundle
- [x] Tests on mapping classes

Commits
-------

4c6e05b7ee [Serializer] Serialize and deserialize from abstract classes
2017-12-07 10:34:02 -08:00
Samuel ROZE
4c6e05b7ee [Serializer] Serialize and deserialize from abstract classes 2017-12-07 10:34:01 -08:00
Nicolas Grekas
f87380c22a [DI] Force root-namespace for function calls in the dumper container 2017-12-07 18:32:09 +01:00
Nicolas Grekas
f1a7b075a6 [DI] Fix circular-aliases message 2017-12-07 18:21:50 +01:00
Fabien Potencier
db816edd81 feature #25346 [DoctrineBridge] DoctrineDataCollector comments the non runnable part of the query (Simperfit)
This PR was merged into the 4.1-dev branch.

Discussion
----------

[DoctrineBridge] DoctrineDataCollector comments the non runnable part of the query

| Q             | A
| ------------- | ---
| Branch?       | 4.1
| Bug fix?      | yes
| New feature?  | no <!-- don't forget to update src/**/CHANGELOG.md files -->
| BC breaks?    | no
| Deprecations? | no <!-- don't forget to update UPGRADE-*.md files -->
| Tests pass?   | yes
| Fixed tickets | #24782
| License       | MIT
| Doc PR        | symfony/symfony-docs#... <!--highly recommended for new features-->

![img_2932](https://user-images.githubusercontent.com/3451634/33648180-f6c7a5ac-da58-11e7-8bf8-95fc943d16ff.jpeg)

I think the idea in this ticket is good and it should be implemented. Could we go further by adding more things to this feature, or will it be ok to just comment out the un-needed part to make the kiri
![kiri](https://user-images.githubusercontent.com/3451634/33648278-5eccc830-da59-11e7-8034-a1b9efee7673.png)
(french joke for query) runnable ?

Commits
-------

42760d0d7f [DoctrineBridge] DoctrineDataCollector comments the non runnable part of the query
2017-12-07 08:54:57 -08:00
Fabien Potencier
1aa06b8b06 bug #25380 [FrameworkBundle][Cache] register system cache clearer only if it's used (xabbuh)
This PR was merged into the 3.4 branch.

Discussion
----------

[FrameworkBundle][Cache] register system cache clearer only if it's used

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

Commits
-------

093eb3d40d register system cache clearer only if it's used
2017-12-07 08:52:37 -08:00
Fabien Potencier
d220e28a99 feature #24216 added clean option to assets install command (robinlehrmann)
This PR was merged into the 4.1-dev branch.

Discussion
----------

added clean option to assets install command

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

Commits
-------

771f11b994 added clean option to assets install command
2017-12-07 08:16:48 -08:00
Fabien Potencier
04c371277b feature #25142 [Process] Create a "isTtySupported" static method (nesk)
This PR was merged into the 4.1-dev branch.

Discussion
----------

[Process] Create a "isTtySupported" static method

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

Currently, there is no way to enable the TTY mode without risking an exception. This PR extracts the code checking for TTY support and provides it in a `isTtySupported` static method.

Now we can enable the TTY mode everywhere it's available without risking an exception:

```php
$process = (new Process)->setTty(Process::isTtySupported());
```

_Old comment_:
> I'm targeting the 2.7 branch since this is not really a new feature, just a little refactoring of the existent code, and it is fully backward compatible.

Commits
-------

a1398f6de4 Create a "isTtySupported" static method
2017-12-07 08:15:02 -08:00
Fabien Potencier
7ba6000dd5 bug #25323 [ExpressionLanguage] throw an SyntaxError instead of an undefined index notice (Simperfit)
This PR was merged into the 2.7 branch.

Discussion
----------

[ExpressionLanguage] throw an SyntaxError instead of an undefined index notice

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | yes
| New feature?  | no <!-- don't forget to update src/**/CHANGELOG.md files -->
| BC breaks?    | no
| Deprecations? | no <!-- don't forget to update UPGRADE-*.md files -->
| Tests pass?   | yes
| Fixed tickets | #25214
| License       | MIT
| Doc PR        | none

I think this is a bug when the components throws a notice instead of an exception.

it's too early and too dark to see something outside so here is my couch :
![img_2915-2](https://user-images.githubusercontent.com/3451634/33592448-6b514050-d98b-11e7-8086-bc6e6b6e6e82.jpg)

Commits
-------

78abc89648 [ExpressionLanguage] throw an SyntaxError instead of letting a undefined index notice
2017-12-07 08:13:11 -08:00
Christian Flothmann
093eb3d40d register system cache clearer only if it's used 2017-12-07 17:10:25 +01:00
Fabien Potencier
d57303faa6 bug #25363 [HttpKernel] Disable inlining on PHP 5 (nicolas-grekas)
This PR was merged into the 3.4 branch.

Discussion
----------

[HttpKernel] Disable inlining on PHP 5

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

Commits
-------

950fd9916b [HttpKernel] Disable inlining on PHP 5
2017-12-07 08:10:00 -08:00
Fabien Potencier
6e7e6847d9 bug #25364 [DependencyInjection] Prevent a loop in aliases within the findDefinition method (sroze)
This PR was merged into the 3.3 branch.

Discussion
----------

[DependencyInjection] Prevent a loop in aliases within the `findDefinition` method

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

This prevents an infinite loop going when aliases reference themselves. This is based on 3.3 as the "normalized ID" changed to allow non-lowercase names. Fixing this in 2.7 would mean a merge conflict that IMO is not worth it.

Commits
-------

22f35239a4 Prevent a loop in aliases within the `findDefinition` method
2017-12-07 08:06:29 -08:00
Fabien Potencier
ae3d899b08 minor #25339 [DX][HttpKernel] Throw a sensible exception when controller has been removed (sroze)
This PR was merged into the 3.4 branch.

Discussion
----------

[DX][HttpKernel] Throw a sensible exception when controller has been removed

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

Following on #25201, we need to throw the same kind of sensible exception when the controller service is not found.

Commits
-------

458d63fbb9 Throw a sensible exception when controller has been removed
2017-12-07 08:02:42 -08:00
Selvi ARIK
ef2ca5652a
doc : Namespace prefix must end with a "\" 2017-12-07 14:36:34 +01:00
Grégoire Pineau
7c0b1cd299 feature #24751 [Workflow] Introduce a Workflow interface (Simperfit)
This PR was merged into the 4.1-dev branch.

Discussion
----------

[Workflow] Introduce a Workflow interface

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

@chalasr I think all the points you made in 23910 has been done. Needs to update the docs too.

Commits
-------

e8351d8 [Workflow] Introduce a Workflow interface
2017-12-07 13:53:16 +01:00
Amrouche Hamza
78abc89648
[ExpressionLanguage] throw an SyntaxError instead of letting a undefined index notice 2017-12-07 10:26:22 +01:00
Roland Franssen
a203d31838 [HttpKernel] Decouple exception logging from rendering 2017-12-06 19:15:30 +01:00
Samuel ROZE
22f35239a4
Prevent a loop in aliases within the findDefinition method 2017-12-06 16:40:30 +00:00
Nicolas Grekas
950fd9916b [HttpKernel] Disable inlining on PHP 5 2017-12-06 16:28:34 +01:00
Samuel ROZE
28f00866b1
Ensure that inlined services with parameterized class name can be dumped 2017-12-06 12:35:11 +00:00
Nicolas Grekas
730b156f35 [DI] Fix non-string class handling in PhpDumper 2017-12-06 13:03:52 +01:00
Amrouche Hamza
42760d0d7f
[DoctrineBridge] DoctrineDataCollector comments the non runnable part of the query 2017-12-06 13:00:46 +01:00
Samuel ROZE
458d63fbb9
Throw a sensible exception when controller has been removed 2017-12-06 11:59:38 +00:00
Robin Chalas
32b3db58f4 minor #25352 [Console] Fix phpdoc in Table class (maidmaid)
This PR was merged into the 2.7 branch.

Discussion
----------

[Console] Fix phpdoc in Table class

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

Before:
![screenshot from 2017-12-06 20-37-01](https://user-images.githubusercontent.com/4578773/33657735-eaeda05c-dac5-11e7-97da-1af0a8dc0c74.png)

After:
![screenshot from 2017-12-06 20-37-43](https://user-images.githubusercontent.com/4578773/33657737-eda77fde-dac5-11e7-83ea-7fc9bf097f17.png)

Commits
-------

a7d4489 Fix php doc in Table class
2017-12-06 11:48:25 +01:00
Nicolas Grekas
931fe35e4d bug #25337 Remove Exclusive Lock That Breaks NFS Caching (brianfreytag)
This PR was merged into the 3.4 branch.

Discussion
----------

Remove Exclusive Lock That Breaks NFS Caching

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

#24960 introduced an issue with NFS mounts that do not support exclusive locks. This reverts that change.

FYI @kalessil

Commits
-------

a7ac100 Remove LOCK_EX That Breaks Cache Usage on NFS
2017-12-06 11:09:02 +01:00
Brian Freytag
a7ac100c45 Remove LOCK_EX That Breaks Cache Usage on NFS
This removes the exclusive lock that was introduced in #24960.

NFS File Systems do not support exclusive locking, and generates a lot
of errors every time you try to do anything with che cache.
2017-12-05 10:17:41 -05:00
Dany Maillard
a7d44895e0 Fix php doc in Table class 2017-12-05 23:53:48 +10:00
Romain Neutron
6b5ab90b5b
[VarDumper] Allow VarDumperTestTrait expectation to be non-scalar 2017-12-05 13:52:08 +01:00
Christian Flothmann
956287be72 do not evaluate PHP constant names
PHP constant identifiers must be strings anyway. Thus, we only need to
parse quoted strings, but do not have to evaluate the data types.
2017-12-05 09:19:51 +01:00
Roman Orlov
3b910a9fad [Serializer] improved CsvEncoder::decode performance by caching duplicate count calls 2017-12-05 17:56:53 +10:00
Fabien Potencier
441cfb98d8 bumped Symfony version to 4.0.2 2017-12-04 16:25:53 -08:00
Fabien Potencier
7e51b0df89
Merge pull request #25322 from fabpot/release-4.0.1
released v4.0.1
2017-12-04 16:19:42 -08:00
Fabien Potencier
da67aa7d67 updated VERSION for 4.0.1 2017-12-04 16:18:20 -08:00
Fabien Potencier
34f90255e6 updated CHANGELOG for 4.0.1 2017-12-04 16:18:14 -08:00
Fabien Potencier
22a6a7e4c5 bumped Symfony version to 3.4.2 2017-12-04 16:17:08 -08:00
Fabien Potencier
46d4a9027c
Merge pull request #25321 from fabpot/release-3.4.1
released v3.4.1
2017-12-04 15:05:15 -08:00
Fabien Potencier
3a2d88fc6a updated VERSION for 3.4.1 2017-12-04 15:05:00 -08:00
Fabien Potencier
0e73257ef0 updated CHANGELOG for 3.4.1 2017-12-04 15:04:54 -08:00
Fabien Potencier
b783602622 bumped Symfony version to 3.3.15 2017-12-04 15:02:34 -08:00
Fabien Potencier
8e2b473de6
Merge pull request #25319 from fabpot/release-3.3.14
released v3.3.14
2017-12-04 14:26:41 -08:00
Fabien Potencier
4965ef5311 updated VERSION for 3.3.14 2017-12-04 14:26:28 -08:00
Fabien Potencier
b1a1a8fb5c updated CHANGELOG for 3.3.14 2017-12-04 14:26:15 -08:00
Fabien Potencier
e8b5aa1cd1 bumped Symfony version to 2.8.33 2017-12-04 14:24:43 -08:00
Fabien Potencier
0efa80d0a0
Merge pull request #25318 from fabpot/release-2.8.32
released v2.8.32
2017-12-04 14:02:29 -08:00
Fabien Potencier
525b5ff976 updated VERSION for 2.8.32 2017-12-04 14:02:14 -08:00
Fabien Potencier
67eb592d0e updated CHANGELOG for 2.8.32 2017-12-04 14:02:09 -08:00
Fabien Potencier
2c3344b8b7 bumped Symfony version to 2.7.40 2017-12-04 13:53:49 -08:00