Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Workflow] Removed deprecated features #22771

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 19, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion 8 src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
CHANGELOG
=========

4.0.0
-----

* Removed `ValidateWorkflowsPass`
* The default `type` option of the `framework.workflows.*` configuration entries is `state_machine`

3.3.0
-----

Expand Down Expand Up @@ -47,7 +53,7 @@ CHANGELOG
`Symfony\Component\Validator\DependencyInjection\AddValidatorInitializersPass` instead
* Deprecated `AddConstraintValidatorsPass`, use
`Symfony\Component\Validator\DependencyInjection\AddConstraintValidatorsPass` instead
* Deprecated `ValidateWorkflowsPass`, use
* Deprecated `ValidateWorkflowsPass`, use
`Symfony\Component\Workflow\DependencyInjection\ValidateWorkflowsPass` instead

3.2.0
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ private function addWorkflowSection(ArrayNodeDefinition $rootNode)
->end()
->enumNode('type')
->values(array('workflow', 'state_machine'))
->defaultValue('state_machine')
->end()
->arrayNode('marking_store')
->fixXmlConfig('argument')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -498,10 +498,6 @@ private function registerWorkflowConfiguration(array $workflows, ContainerBuilde
$registryDefinition = $container->getDefinition('workflow.registry');

foreach ($workflows as $name => $workflow) {
if (!array_key_exists('type', $workflow)) {
$workflow['type'] = 'workflow';
@trigger_error(sprintf('The "type" option of the "framework.workflows.%s" configuration entry must be defined since Symfony 3.3. The default value will be "state_machine" in Symfony 4.0.', $name), E_USER_DEPRECATED);
}
$type = $workflow['type'];

$transitions = array();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
),
),
'pull_request' => array(
'type' => 'state_machine',
'marking_store' => array(
'type' => 'single_state',
),
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
</framework:transition>
</framework:workflow>

<framework:workflow name="pull_request" type="state_machine" initial-place="start">
<framework:workflow name="pull_request" initial-place="start">
<framework:marking-store type="single_state"/>
<framework:support>Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\FrameworkExtensionTest</framework:support>
<framework:place>start</framework:place>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ framework:
from: [approved_by_journalist, approved_by_spellchecker]
to: [published]
pull_request:
type: state_machine
marking_store:
type: single_state
supports:
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,9 @@ public function testWorkflows()
{
$container = $this->createContainerFromFile('workflows');

$this->assertTrue($container->hasDefinition('workflow.article', 'Workflow is registered as a service'));
$this->assertTrue($container->hasDefinition('workflow.article.definition', 'Workflow definition is registered as a service'));
$this->assertTrue($container->hasDefinition('workflow.article'), 'Workflow is registered as a service');
$this->assertSame('workflow.abstract', $container->getDefinition('workflow.article')->getParent());
$this->assertTrue($container->hasDefinition('workflow.article.definition'), 'Workflow definition is registered as a service');

$workflowDefinition = $container->getDefinition('workflow.article.definition');

Expand All @@ -173,8 +174,9 @@ public function testWorkflows()
);
$this->assertSame(array('workflow.definition' => array(array('name' => 'article', 'type' => 'workflow', 'marking_store' => 'multiple_state'))), $workflowDefinition->getTags());

$this->assertTrue($container->hasDefinition('state_machine.pull_request', 'State machine is registered as a service'));
$this->assertTrue($container->hasDefinition('state_machine.pull_request.definition', 'State machine definition is registered as a service'));
$this->assertTrue($container->hasDefinition('state_machine.pull_request'), 'State machine is registered as a service');
$this->assertSame('state_machine.abstract', $container->getDefinition('state_machine.pull_request')->getParent());
$this->assertTrue($container->hasDefinition('state_machine.pull_request.definition'), 'State machine definition is registered as a service');
$this->assertCount(4, $workflowDefinition->getArgument(1));
$this->assertSame('draft', $workflowDefinition->getArgument(2));

Expand Down Expand Up @@ -207,15 +209,6 @@ public function testWorkflows()
$this->assertGreaterThan(0, count($registryDefinition->getMethodCalls()));
}

/**
* @group legacy
* @expectedDeprecation The "type" option of the "framework.workflows.missing_type" configuration entry must be defined since Symfony 3.3. The default value will be "state_machine" in Symfony 4.0.
*/
public function testDeprecatedWorkflowMissingType()
{
$container = $this->createContainerFromFile('workflows_without_type');
}

/**
* @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
* @expectedExceptionMessage "type" and "service" cannot be used together.
Expand Down
5 changes: 5 additions & 0 deletions 5 src/Symfony/Component/Workflow/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
CHANGELOG
=========

4.0.0
-----

* Removed class name support in `WorkflowRegistry::add()` as second parameter.

3.3.0
-----

Expand Down
11 changes: 4 additions & 7 deletions 11 src/Symfony/Component/Workflow/Registry.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
namespace Symfony\Component\Workflow;

use Symfony\Component\Workflow\Exception\InvalidArgumentException;
use Symfony\Component\Workflow\SupportStrategy\ClassInstanceSupportStrategy;
use Symfony\Component\Workflow\SupportStrategy\SupportStrategyInterface;

/**
Expand All @@ -24,15 +23,13 @@ class Registry
private $workflows = array();

/**
* @param Workflow $workflow
* @param string|SupportStrategyInterface $supportStrategy
* @param Workflow $workflow
* @param SupportStrategyInterface $supportStrategy
*/
public function add(Workflow $workflow, $supportStrategy)
{
if (!$supportStrategy instanceof SupportStrategyInterface) {
@trigger_error('Support of class name string was deprecated after version 3.2 and won\'t work anymore in 4.0.', E_USER_DEPRECATED);

$supportStrategy = new ClassInstanceSupportStrategy($supportStrategy);
throw new \InvalidArgumentException('The "supportStrategy" is not an instance of SupportStrategyInterface.');
}

$this->workflows[] = array($workflow, $supportStrategy);
Expand Down Expand Up @@ -64,7 +61,7 @@ public function get($subject, $workflowName = null)
return $matched;
}

private function supports(Workflow $workflow, $supportStrategy, $subject, $workflowName)
private function supports(Workflow $workflow, SupportStrategyInterface $supportStrategy, $subject, $workflowName)
{
if (null !== $workflowName && $workflowName !== $workflow->getName()) {
return false;
Expand Down
23 changes: 0 additions & 23 deletions 23 src/Symfony/Component/Workflow/Tests/RegistryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,29 +65,6 @@ public function testGetWithNoMatch()
$this->assertSame('workflow1', $w1->getName());
}

/**
* @group legacy
*/
public function testGetWithSuccessLegacyStrategy()
{
$registry = new Registry();

$registry->add(new Workflow(new Definition(array(), array()), $this->getMockBuilder(MarkingStoreInterface::class)->getMock(), $this->getMockBuilder(EventDispatcherInterface::class)->getMock(), 'workflow1'), Subject1::class);
$registry->add(new Workflow(new Definition(array(), array()), $this->getMockBuilder(MarkingStoreInterface::class)->getMock(), $this->getMockBuilder(EventDispatcherInterface::class)->getMock(), 'workflow2'), Subject2::class);

$workflow = $registry->get(new Subject1());
$this->assertInstanceOf(Workflow::class, $workflow);
$this->assertSame('workflow1', $workflow->getName());

$workflow = $registry->get(new Subject1(), 'workflow1');
$this->assertInstanceOf(Workflow::class, $workflow);
$this->assertSame('workflow1', $workflow->getName());

$workflow = $registry->get(new Subject2(), 'workflow2');
$this->assertInstanceOf(Workflow::class, $workflow);
$this->assertSame('workflow2', $workflow->getName());
}

private function createSupportStrategy($supportedClassName)
{
$strategy = $this->getMockBuilder(SupportStrategyInterface::class)->getMock();
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.