Skip to content

Conversation

@iteman
Copy link
Member

@iteman iteman commented Sep 1, 2016

Q A
Branch? master
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? -
Fixed tickets -
License BSD-2-Clause

This PR adds the Service Task support.

When a Service Task is reached in the process, the task will be allocated and started automatically, and the associated Symfony service is executed at the started state on the work item. And the task will be completed automatically.

Symfony services for this must implement PHPMentors\Workflower\Workflow\Operation\OperationRunnerInterface as the following:

<?php
...
use PHPMentors\Workflower\Workflow\Operation\OperationalInterface;
use PHPMentors\Workflower\Workflow\Operation\OperationRunnerInterface;
use PHPMentors\Workflower\Workflow\Workflow;
use PHPMentors\WorkflowerBundle\Workflow\Participant\SecurityParticipant;
use PHPMentors\WorkflowerBundle\Workflow\Participant\SecurityParticipantAwareInterface;

class ...OperationRunner implements OperationRunnerInterface, SecurityParticipantAwareInterface
{
    private $securityParticipant;

    public function setSecurityParticipant(SecurityParticipant $participant)
    {
        $this->securityParticipant = $participant;
    }

    public function provideParticipant(OperationalInterface $operational, Workflow $workflow)
    {
        return $this->securityParticipant;
    }

    public function run(OperationalInterface $operational, Workflow $workflow)
    {
        ...
    }
}

And the Symfony service for an operation runner should be tagged as phpmentors_workflower.operation_runner with phpmentors_workflower.security_participant_aware as the following:

    ..._operation_runner:
        ...
        tags:
            - { name: phpmentors_workflower.operation_runner }
            - { name: phpmentors_workflower.security_participant_aware }

@iteman iteman merged commit 31577ff into phpmentors-jp:master Sep 1, 2016
iteman added a commit that referenced this pull request Sep 1, 2016
This PR was merged into the 1.2-dev branch.

Discussion
----------

Service Task support

| Q             | A
| ------------- | ---
| Branch?       | `master`
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | -
| Fixed tickets | -
| License       | BSD-2-Clause

This PR adds the Service Task support.

When a Service Task is reached in the process, the task will be allocated and started automatically, and the associated Symfony service is executed at the `started` state on the work item. And the task will be completed automatically.

Symfony services for this must implement `PHPMentors\Workflower\Workflow\Operation\OperationRunnerInterface` as the following:

```php
<?php
...
use PHPMentors\Workflower\Workflow\Operation\OperationalInterface;
use PHPMentors\Workflower\Workflow\Operation\OperationRunnerInterface;
use PHPMentors\Workflower\Workflow\Workflow;
use PHPMentors\WorkflowerBundle\Workflow\Participant\SecurityParticipant;
use PHPMentors\WorkflowerBundle\Workflow\Participant\SecurityParticipantAwareInterface;

class ...OperationRunner implements OperationRunnerInterface, SecurityParticipantAwareInterface
{
    private $securityParticipant;

    public function setSecurityParticipant(SecurityParticipant $participant)
    {
        $this->securityParticipant = $participant;
    }

    public function provideParticipant(OperationalInterface $operational, Workflow $workflow)
    {
        return $this->securityParticipant;
    }

    public function run(OperationalInterface $operational, Workflow $workflow)
    {
        ...
    }
}
```

And the Symfony service for an operation runner should be tagged as `phpmentors_workflower.operation_runner` with `phpmentors_workflower.security_participant_aware` as the following:

```yaml
    ..._operation_runner:
        ...
        tags:
            - { name: phpmentors_workflower.operation_runner }
            - { name: phpmentors_workflower.security_participant_aware }
```

Commits
-------

441f3f9 change the scope of `phpmentors_workflower.security_participant` to the container scope
31577ff add support for Service Tasks by the service tag `phpmentors_workflower.operation_runner`
@iteman iteman added this to the 1.2.0 milestone Sep 1, 2016
@iteman iteman self-assigned this Sep 1, 2016
@iteman iteman deleted the service-tasks branch September 1, 2016 06:40
iteman added a commit that referenced this pull request Sep 2, 2016
…y instead of the `OperationRunnerInterface` collection #8
iteman added a commit that referenced this pull request Sep 2, 2016
… the tag 'phpmentors_workflower.security_participant_aware' #8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant