Closed
Description
Q | A |
---|---|
Bug report? | no |
Feature request? | yes |
BC Break report? | no |
RFC? | no |
Symfony version | 3.5 |
workflow
offer:
type: 'workflow'
marking_store:
type: 'single_state'
supports:
- OfferBundle\Entity\Offer
places:
- draft
- published
- published_public
- published_private
- published_failed
- unpublished
- blocked
- rejected
transitions:
published:
from: [draft, unpublished]
to: published
published_public:
from: published
to: published_public
published_private:
from: published
to: published_private
published_failed:
from: published
to: published_failed
unpublished:
from: published
to: unpublished
rejected:
from: [published, unpublished]
to: rejected
class OfferWorkflowListener implements EventSubscriberInterface {
public function guardPublishPrivate(GuardEvent $event){
var_dump("guardPublishPrivate");
}
public function guardPublishPublic(GuardEvent $event){
var_dump("guardPublishPublic");
}
public function guardPublishFailed(GuardEvent $event){
var_dump("guardPublishFailed");
}
public static function getSubscribedEvents() {
return [
'workflow.offer.guard.published_private' => 'guardPublishPrivate',
'workflow.offer.guard.published_public' => 'guardPublishPublic',
'workflow.offer.guard.published_failed' => 'guardPublishFailed',
];
}
}
after call workflow->can($offer, 'published_private')
output is
guardPublishPublic
guardPublishPrivate
guardPublishFailed
but must be unique
guardPublishPrivate method call.
But is must only one event there is transition not all event where workflow have "from:published"