From d1f4384d82256efa27e9a0a97c7cedab1de5e8e4 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Tue, 27 Mar 2018 17:34:51 +0200 Subject: [PATCH] Use the new TransitionException in Workflow examples --- workflow/usage.rst | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/workflow/usage.rst b/workflow/usage.rst index 2126a61d701..ae374644d71 100644 --- a/workflow/usage.rst +++ b/workflow/usage.rst @@ -181,7 +181,7 @@ you can get the workflow by injecting the Workflow registry service:: use Symfony\Component\Workflow\Registry; use App\Entity\BlogPost; use Symfony\Bundle\FrameworkBundle\Controller\Controller; - use Symfony\Component\Workflow\Exception\LogicException; + use Symfony\Component\Workflow\Exception\TransitionException; class BlogController extends Controller { @@ -200,7 +200,7 @@ you can get the workflow by injecting the Workflow registry service:: // Update the currentState on the post try { $workflow->apply($post, 'to_review'); - } catch (LogicException $exception) { + } catch (TransitionException $exception) { // ... if the transition is not allowed } @@ -209,6 +209,10 @@ you can get the workflow by injecting the Workflow registry service:: } } +.. versionadded:: 4.1 + The :class:`Symfony\\Component\\Workflow\\Exception\\TransitionException` + class was introduced in Symfony 4.1. + Using Events ------------