Commit Graph

26790 Commits

Author SHA1 Message Date
Fabien Potencier
3c47306719 Merge branch '3.1'
* 3.1:
  [CS] Respect PSR2 4.2
  [Form] fix `empty_data` option in expanded `ChoiceType`
  [Console] removed unneeded private methods
  updated Http-Kernel dependency
  [Security] [Guard] Improve comment with working example
  sync min email validator version
  [TwigBridge] Fix inconsistency in LintCommand help
  explicitly forbid e-mail validator 2.0 or higher
  Fixed SymfonyQuestionHelper multi-choice with defaults
  [DoctrineBridge] Don't use object IDs in DoctrineChoiceLoader when passing a value closure
  Differentiate between the first time a progress bar is displayed and subsequent times
  finished previous commit
  No more exception for malformed input name
  fix post_max_size_message translation
  [Process] Fix pipes cleaning on Windows
  Avoid phpunit 5.4 warnings on getMock
  [Form] Add exception to FormRenderer about non-unique block names
  [FrameworkBundle] templating can be fully disabled
  [Form] Consider a violation even if the form is not submitted
2016-06-28 18:31:08 +02:00
Tugdual Saunier
ae99aa8ea4 [Security] Allow LDAP loadUser override 2016-06-28 17:28:10 +01:00
Fabien Potencier
45ce2c87f4 Merge branch '3.0' into 3.1
* 3.0:
  [CS] Respect PSR2 4.2
  [Form] fix `empty_data` option in expanded `ChoiceType`
  [Console] removed unneeded private methods
  [Security] [Guard] Improve comment with working example
  sync min email validator version
  [TwigBridge] Fix inconsistency in LintCommand help
  explicitly forbid e-mail validator 2.0 or higher
  Fixed SymfonyQuestionHelper multi-choice with defaults
  [DoctrineBridge] Don't use object IDs in DoctrineChoiceLoader when passing a value closure
  Differentiate between the first time a progress bar is displayed and subsequent times
  finished previous commit
  No more exception for malformed input name
  fix post_max_size_message translation
  [Process] Fix pipes cleaning on Windows
  Avoid phpunit 5.4 warnings on getMock
  [Form] Add exception to FormRenderer about non-unique block names
  [Form] Consider a violation even if the form is not submitted
2016-06-28 18:26:56 +02:00
Fabien Potencier
ba841600a0 Merge branch '2.8' into 3.0
* 2.8:
  [CS] Respect PSR2 4.2
  [Form] fix `empty_data` option in expanded `ChoiceType`
  [Console] removed unneeded private methods
  [Security] [Guard] Improve comment with working example
  sync min email validator version
  [TwigBridge] Fix inconsistency in LintCommand help
  explicitly forbid e-mail validator 2.0 or higher
  Fixed SymfonyQuestionHelper multi-choice with defaults
  [DoctrineBridge] Don't use object IDs in DoctrineChoiceLoader when passing a value closure
  Differentiate between the first time a progress bar is displayed and subsequent times
  finished previous commit
  No more exception for malformed input name
  fix post_max_size_message translation
  [Process] Fix pipes cleaning on Windows
  Avoid phpunit 5.4 warnings on getMock
  [Form] Add exception to FormRenderer about non-unique block names
  [Form] Consider a violation even if the form is not submitted
2016-06-28 18:26:27 +02:00
Fabien Potencier
6b81f2ce43 Merge branch '2.7' into 2.8
* 2.7:
  [CS] Respect PSR2 4.2
  [Form] fix `empty_data` option in expanded `ChoiceType`
  [Console] removed unneeded private methods
  sync min email validator version
  [TwigBridge] Fix inconsistency in LintCommand help
  explicitly forbid e-mail validator 2.0 or higher
  Fixed SymfonyQuestionHelper multi-choice with defaults
  [DoctrineBridge] Don't use object IDs in DoctrineChoiceLoader when passing a value closure
  Differentiate between the first time a progress bar is displayed and subsequent times
  finished previous commit
  No more exception for malformed input name
  fix post_max_size_message translation
  [Process] Fix pipes cleaning on Windows
  Avoid phpunit 5.4 warnings on getMock
  [Form] Add exception to FormRenderer about non-unique block names
  [Form] Consider a violation even if the form is not submitted
2016-06-28 18:24:07 +02:00
Fabien Potencier
f67912fe3a feature #18823 [Cache] Add PhpArrayAdapter to use shared memory on PHP 7.0 (tgalopin)
This PR was merged into the 3.2-dev branch.

Discussion
----------

[Cache] Add PhpArrayAdapter to use shared memory on PHP 7.0

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

Depends on https://github.com/symfony/symfony/pull/18825

This PR aims to implement a Symfony Cache adapter able to build files optimized for OPCache memory storage. Any kind of static data that can be warmed up is a candidate for OPcache storage.

This PR is limited to the implementation of the Adapter. It's usage in the annotations caching system is implemented in the PR https://github.com/symfony/symfony/pull/18533. The aim is also to use this adapter in other contexts (validator, serializer, ...).

Commits
-------

28a40d2 [Cache] Add PhpArrayAdapter to use shared memory on PHP 7.0+
2016-06-28 12:05:50 +02:00
Titouan Galopin
28a40d21f5 [Cache] Add PhpArrayAdapter to use shared memory on PHP 7.0+ 2016-06-28 11:48:20 +02:00
Hugo Hamon
4ed70c4a4e [DependencyInjection] deprecate access to private shared services. Fixes issue #19117. 2016-06-28 09:16:13 +02:00
Fabien Potencier
554303e339 removed dots at the end of @param and @return 2016-06-28 08:24:06 +02:00
Fabien Potencier
7dbd849d0f bug #17822 [WIP] [2.7] [Form] fix empty_data option in expanded ChoiceType (HeahDude)
This PR was merged into the 2.7 branch.

Discussion
----------

[WIP] [2.7] [Form] fix `empty_data` option in expanded `ChoiceType`

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

It might happen because in `Form::submit()` the handling of `empty_data` [line 597](https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Form/Form.php#L597) comes after each child of a compound field has been submitted [line 549](https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Form/Form.php#L549).

So when `ChoiceType` is `expanded`, `compound` option is defaulted to `true` and it passes its empty submitted data to its children before handling its own `empty_data` option.

This PR uses the listener already added in `ChoiceType` only when `expanded` is true to handle `empty_data` at `PRE_SUBMIT` [line 539](https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Form/Form.php#L539).

- [ ] Fix FQCN in tests for 2.8
- [ ] Remove `choices_as_values` in tests for 3.0

Commits
-------

d479adf [Form] fix `empty_data` option in expanded `ChoiceType`
2016-06-28 08:17:04 +02:00
Nicolas Grekas
160185c3d0 minor #19200 [VarDumper] Allow full collapsing of HTML dumps (nicolas-grekas)
This PR was merged into the 3.2-dev branch.

Discussion
----------

[VarDumper] Allow full collapsing of HTML dumps

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

Because I missed the feature request in #16741 to allow full collapsing.

Commits
-------

633989b [VarDumper] Allow full collapsing of HTML dumps
2016-06-28 08:16:50 +02:00
Nicolas Grekas
633989b583 [VarDumper] Allow full collapsing of HTML dumps 2016-06-28 08:09:15 +02:00
Fabien Potencier
e334960776 fixed typo 2016-06-28 07:56:13 +02:00
Fabien Potencier
76791fedb4 feature #18948 [VarDumper] Add maxDepth & maxStringLength display options (MGDSoft, nicolas-grekas)
This PR was merged into the 3.2-dev branch.

Discussion
----------

[VarDumper] Add maxDepth & maxStringLength display options

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

Takes over #18148 to add display options to html dumps.
Status: needs work

Commits
-------

998ff33 [VarDumper] Tweak display options implementation
58eb665 [VarDumper] Add maxDepth & maxStringLength display options
2016-06-28 07:43:23 +02:00
Fabien Potencier
d8dd7f6fae minor #19176 [CS] Respect PSR2 4.2 (phansys)
This PR was merged into the 2.7 branch.

Discussion
----------

[CS] Respect PSR2 4.2

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

http://www.php-fig.org/psr/psr-2/#4-2-properties

I'm writing a [new fixer](https://github.com/FriendsOfPHP/PHP-CS-Fixer/pull/1889) (`single_class_element_per_statement`), which intends to avoid multiple class elements in one statement.
This PR is a POC about the result of this fixer, so I'd like to know what do you think about, since it will be also added to the `@Symfony` ruleset.
Please note that class constants are considered too, but here isn't any offending code about that.

Example output:
```
$ ./php-cs-fixer.phar fix . --rules=single_class_element_per_statement -vvv
   1) src/Symfony/Component/Console/Tests/Input/InputDefinitionTest.php (single_class_element_per_statement)
   2) src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php (single_class_element_per_statement)
   3) src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/foo.php (single_class_element_per_statement)
   4) src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/Fixtures/includes/foo.php (single_class_element_per_statement)
```

Commits
-------

d250b1d [CS] Respect PSR2 4.2
2016-06-27 07:50:33 +02:00
Ener-Getick
9be648420d
[Serializer] Allow to use easily static constructors 2016-06-26 21:23:55 +02:00
Javier Spagnoletti
d250b1d0f0 [CS] Respect PSR2 4.2
| 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        |

http://www.php-fig.org/psr/psr-2/#4-2-properties
2016-06-25 13:30:09 -03:00
Nicolas Grekas
998ff33e89 [VarDumper] Tweak display options implementation 2016-06-25 18:14:07 +02:00
MGDSoft
58eb665132 [VarDumper] Add maxDepth & maxStringLength display options 2016-06-25 17:49:26 +02:00
Jules Pietri
d479adf073 [Form] fix empty_data option in expanded ChoiceType 2016-06-25 16:15:36 +02:00
Nicolas Grekas
7cc6161c76 [FrameworkBundle] Show server:run logs by default 2016-06-25 09:10:45 +02:00
Robin Chalas
dd84b7fbc5 [Yaml] Avoid using both Input/Output and SymfonyStyle in LintCommand
Remove input/output from method arguments, use SymfonyStyle instead
Avoid 'error in filename' if no filename as argument
Add missing array typehint to files argument of display*() methods
Store format option as member rather than pass it in method calls

CS fixes
2016-06-24 11:18:17 +02:00
Fabien Potencier
06f5c86c33 minor #19166 Undefined variable $name (IvanMenshykov)
This PR was merged into the 3.2-dev branch.

Discussion
----------

Undefined variable $name

| Q             | A
| ------------- | ---
| Branch?       | "master" for new features / 2.7, 2.8, 3.0 or 3.1 for fixes
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| License       | MIT

Commits
-------

8304bcc Undefined variable $name
2016-06-24 10:49:17 +02:00
Fabien Potencier
f40c703c1e minor #19164 [Console] update the author of the LockableTrait (xabbuh)
This PR was merged into the 3.2-dev branch.

Discussion
----------

[Console] update the author of the LockableTrait

| 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/18471#discussion_r68284858
| License       | MIT
| Doc PR        |

Commits
-------

b15fec7 update the author of the LockableTrait
2016-06-24 10:48:04 +02:00
Ivan Menshykov
8304bccbfb Undefined variable $name 2016-06-24 10:16:28 +02:00
Christian Flothmann
b15fec757f update the author of the LockableTrait 2016-06-24 08:07:32 +02:00
Fabien Potencier
fad545aff9 minor #19163 [Console] removed unneeded private methods (fabpot)
This PR was merged into the 2.7 branch.

Discussion
----------

[Console] removed unneeded private methods

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

Commits
-------

35f32eb [Console] removed unneeded private methods
2016-06-24 07:34:54 +02:00
Fabien Potencier
35f32ebe12 [Console] removed unneeded private methods 2016-06-24 07:18:49 +02:00
Fabien Potencier
b10ca1f120 minor #19158 [Console] LockableTrait: change visibility to private (xabbuh)
This PR was merged into the 3.2-dev branch.

Discussion
----------

[Console] LockableTrait: change visibility to private

| 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/18471#discussion_r68231747
| License       | MIT
| Doc PR        |

Without this change we force users to expose unnecessary extension points they may not want to provide.

Commits
-------

eaa3bb0 LockableTrait: change visibility to private
2016-06-24 07:13:12 +02:00
Fabien Potencier
c26347d718 bug #19159 [WebProfilerBundle] Added a conflict for Http-Kernel < 3.1 (HeahDude)
This PR was merged into the 3.1 branch.

Discussion
----------

[WebProfilerBundle] Added a conflict for Http-Kernel < 3.1

| Q             | A
| ------------- | ---
| Branch?       | 3.1
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | https://github.com/silexphp/Silex-WebProfiler/issues/94
| License       | MIT
| Doc PR        | ~

Commits
-------

d3f47f7 updated Http-Kernel dependency
2016-06-24 07:11:53 +02:00
Fabien Potencier
358a4ccad7 minor #19155 [FrameworkBundle] Remove redundant code (Ener-Getick)
This PR was merged into the 3.2-dev branch.

Discussion
----------

[FrameworkBundle] Remove redundant code

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

Was part of https://github.com/symfony/symfony/pull/17706.
Change the remaining ``isset($config['foo'])`` to ``$this->isConfigEnabled($config['foo'])`` to allow to use parameters to enable a feature.

Commits
-------

a21af88 [FrameworkBundle] Remove redundant code
2016-06-24 07:10:00 +02:00
Ener-Getick
a21af88b8f
[FrameworkBundle] Remove redundant code 2016-06-23 22:21:15 +02:00
Jules Pietri
d3f47f7f78 updated Http-Kernel dependency
Closes silexphp/Silex-WebProfiler#94.
2016-06-23 21:51:59 +02:00
Christian Flothmann
eaa3bb00c6 LockableTrait: change visibility to private 2016-06-23 20:06:08 +02:00
Fabien Potencier
6e03a4231a feature #18626 [Yaml] Added support for parsing PHP constants (HeahDude)
This PR was merged into the 3.2-dev branch.

Discussion
----------

[Yaml] Added support for parsing PHP constants

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

Commits
-------

17ec26e [DI] added support for PHP constants in yaml configuration files
02d1dea [Yaml] added support for parsing PHP constants
2016-06-23 15:59:50 +02:00
Jules Pietri
17ec26e1e5 [DI] added support for PHP constants in yaml configuration files 2016-06-23 15:44:47 +02:00
Jules Pietri
02d1dea33b [Yaml] added support for parsing PHP constants 2016-06-23 15:44:47 +02:00
Fabien Potencier
4223997a99 fixed CS 2016-06-23 15:33:17 +02:00
Fabien Potencier
b84adede89 feature #19104 Adds support for the SameSite attribute in cookies. (iangcarroll)
This PR was squashed before being merged into the 3.2-dev branch (closes #19104).

Discussion
----------

Adds support for the SameSite attribute in cookies.

| 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

$sameSite can be set to false, "lax", or "strict".

You can read about what the different modes do here: http://www.sjoerdlangkemper.nl/2016/04/14/preventing-csrf-with-samesite-cookie-attribute/

Commits
-------

428d0f7 Adds support for the SameSite attribute in cookies.
2016-06-23 15:32:24 +02:00
Ian Carroll
428d0f7356 Adds support for the SameSite attribute in cookies. 2016-06-23 15:32:21 +02:00
Fabien Potencier
448a390970 bug #19134 Distinguish between first and subsequent progress bar displays (rquadling)
This PR was merged into the 2.7 branch.

Discussion
----------

Distinguish between first and subsequent progress bar displays

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #19133
| License       | MIT
| Doc PR        | reference to the documentation PR, if any

Fixes https://github.com/symfony/symfony/issues/19133

When a progress bar is first displayed, if it is multi-line, previously output lines are erased, depending upon the number of lines in the progress bar.

This patch fixes that be distinguishing between the first display (no erasing of previous output) and subsequent displays of the progress bar.

Commits
-------

3871e1a Differentiate between the first time a progress bar is displayed and subsequent times
2016-06-23 15:30:31 +02:00
Fabien Potencier
9baf51b00f feature #19153 [Validator] support egulias/email-validator 2.x (xabbuh)
This PR was merged into the 3.2-dev branch.

Discussion
----------

[Validator] support egulias/email-validator 2.x

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

Commits
-------

25d39aa support egulias/email-validator 2.x
2016-06-23 15:28:01 +02:00
Fabien Potencier
a80b45de51 feature #11394 [Routing] support for array values in route defaults (xabbuh)
This PR was merged into the 3.2-dev branch.

Discussion
----------

[Routing] support for array values in route defaults

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

As pointed out in symfony/symfony-docs#4017, the ``XmlFileLoader`` was not capable of defining array default values.

- [x] array values
- [x] integer values
- [x] float values
- [x] boolean

Commits
-------

120b35c [Routing] data type support for defaults
2016-06-23 15:25:46 +02:00
Christian Flothmann
25d39aa819 support egulias/email-validator 2.x 2016-06-23 14:45:27 +02:00
Fabien Potencier
d36097b3ef feature #11882 [Workflow] Introducing the workflow component (fabpot, lyrixx)
This PR was merged into the 3.2-dev branch.

Discussion
----------

[Workflow] Introducing the workflow component

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

TODO:

* [x] Add tests
* [x] Add PHP doc
* [x] Add Symfony fullstack integration (Config, DIC, command to dump the state-machine into graphiz format)

So why another component?

This component take another approach that what you can find on [Packagist](https://packagist.org/search/?q=state%20machine).

Here, the workflow component is not tied to a specific object like with [Finite](https://github.com/yohang/Finite). It means that the component workflow is stateless and can be a symfony service.

Some code:

```php
#!/usr/bin/env php
<?php

require __DIR__.'/vendor/autoload.php';

use Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcher;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\Stopwatch\Stopwatch;
use Symfony\Component\Workflow\Definition;
use Symfony\Component\Workflow\Dumper\GraphvizDumper;
use Symfony\Component\Workflow\Marking;
use Symfony\Component\Workflow\MarkingStore\PropertyAccessorMarkingStore;
use Symfony\Component\Workflow\MarkingStore\ScalarMarkingStore;
use Symfony\Component\Workflow\Transition;
use Symfony\Component\Workflow\Workflow;

class Foo
{
    public $marking;

    public function __construct($init = 'a')
    {
        $this->marking = $init;
        $this->marking = [$init => true];
    }
}

$fooDefinition = new Definition(Foo::class);
$fooDefinition->addPlaces([
    'a', 'b', 'c', 'd', 'e', 'f', 'g',
]);

//                                           name  from        to
$fooDefinition->addTransition(new Transition('t1', 'a',        ['b', 'c']));
$fooDefinition->addTransition(new Transition('t2', ['b', 'c'],  'd'));
$fooDefinition->addTransition(new Transition('t3', 'd',         'e'));
$fooDefinition->addTransition(new Transition('t4', 'd',         'f'));
$fooDefinition->addTransition(new Transition('t5', 'e',         'g'));
$fooDefinition->addTransition(new Transition('t6', 'f',         'g'));

$graph = (new GraphvizDumper())->dump($fooDefinition);

$ed = new TraceableEventDispatcher(new EventDispatcher(), new Stopwatch(), new \Monolog\Logger('app'));

// $workflow = new Workflow($fooDefinition, new ScalarMarkingStore(), $ed);
$workflow = new Workflow($fooDefinition, new PropertyAccessorMarkingStore(), $ed);

$foo = new Foo(isset($argv[1]) ? $argv[1] : 'a');

$graph = (new GraphvizDumper())->dump($fooDefinition, $workflow->getMarking($foo));

dump([
    'AvailableTransitions' => $workflow->getAvailableTransitions($foo),
    'CurrentMarking' => clone $workflow->getMarking($foo),
    'can validate t1' => $workflow->can($foo, 't1'),
    'can validate t3' => $workflow->can($foo, 't3'),
    'can validate t6' => $workflow->can($foo, 't6'),
    'apply t1' => clone $workflow->apply($foo, 't1'),
    'can validate t2' => $workflow->can($foo, 't2'),
    'apply t2' => clone $workflow->apply($foo, 't2'),
    'can validate t1 bis' => $workflow->can($foo, 't1'),
    'can validate t3 bis' => $workflow->can($foo, 't3'),
    'can validate t6 bis' => $workflow->can($foo, 't6'),
]);

```

The workflown:

![workflow](https://cloud.githubusercontent.com/assets/408368/14183999/4a43483c-f773-11e5-9c8b-7f157e0cb75f.png)

The output:

```
array:10 [
  "AvailableTransitions" => array:1 [
    0 => Symfony\Component\Workflow\Transition {#4
      -name: "t1"
      -froms: array:1 [
        0 => "a"
      ]
      -tos: array:2 [
        0 => "b"
        1 => "c"
      ]
    }
  ]
  "CurrentMarking" => Symfony\Component\Workflow\Marking {#19
    -places: array:1 [
      "a" => true
    ]
  }
  "can validate t1" => true
  "can validate t3" => false
  "can validate t6" => false
  "apply t1" => Symfony\Component\Workflow\Marking {#22
    -places: array:2 [
      "b" => true
      "c" => true
    ]
  }
  "apply t2" => Symfony\Component\Workflow\Marking {#47
    -places: array:1 [
      "d" => true
    ]
  }
  "can validate t1 bis" => false
  "can validate t3 bis" => true
  "can validate t6 bis" => false
]
```

Commits
-------

078e27f [Workflow] Added initial set of files
17d59a7 added the first more-or-less working version of the Workflow component
2016-06-23 14:39:44 +02:00
Christian Flothmann
120b35c410 [Routing] data type support for defaults
As pointed out in symfony/symfony-docs#4017, the XmlFileLoader was not
capable of defining array default values. Additionally, this commit
adds support for handling associative arrays, boolean, integer, float
and string data types.
2016-06-23 14:28:23 +02:00
Grégoire Pineau
078e27f139 [Workflow] Added initial set of files 2016-06-23 14:28:20 +02:00
Fabien Potencier
17d59a7c66 added the first more-or-less working version of the Workflow component 2016-06-23 14:28:15 +02:00
Fabien Potencier
9af416d096 feature #19151 [VarDumper] Add support for XmlReader objects (Taluu)
This PR was merged into the 3.2-dev branch.

Discussion
----------

[VarDumper] Add support for XmlReader objects

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

Commits
-------

3779ee4 [VarDumper] Add support for XmlReader objects
2016-06-23 13:55:51 +02:00
Fabien Potencier
43f9514db5 feature #18471 [Console] Add Lockable trait (geoffrey-brier)
This PR was merged into the 3.2-dev branch.

Discussion
----------

[Console] Add Lockable trait

| 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 for the moment :)

Hi there,

Since the 2.6 the `LockHandler` class was added to ease concurrency problems. There was a nice post about [using it in your commands](http://symfony.com/blog/new-in-symfony-2-6-lockhandler).

From my humble experience, I find it a bit unpleasant/time consuming to always copy/paste the same code. So here is my proposal:

Before:

```php
class UpdateContentsCommand extends Command
{
    protected function configure()
    {
        // ...
    }

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        // create the lock
        $lock = new LockHandler('update:contents');
        if (!$lock->lock()) {
            $output->writeln('The command is already running in another process.');

            return 0;
        }

      // Your code

        $lock->release();
    }
}
```

After:

```php
class MyCommand extends Command
{
    use LockableTrait;

    protected function execute(InputInterface $input, OutputInterface $output)
    {
         if (!$this->lock()) {
             // Here you can handle locking errors
         }
        // Your code
        // The lock release is still optionnal
         $this->release();
    }
}
```
In addition, you can optionally pass two arguments:
- a string argument to change the lock name
- a boolean argument to indicate if you want to wait until the requested lock is released

Commits
-------

b57a83f [Console] Add Lockable trait
2016-06-23 13:46:59 +02:00