You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In dev environment, when using the workflow_transition() (not to be confused with workflow_transactions()) in a twig template to get a specific workflow transition, the following error occurs:
An exception has been thrown during the rendering of a template ("Call to undefined method Symfony\Component\Workflow\Debug\TraceableWorkflow::getEnabledTransition()").
This is due to the TraceableWorkflow, introduced in Symfony 6.4.0 not having the getEnabledTransition method implemented, which is implemented in the 'normal' Workflow class. This method is called from the symfony/twig-bridge/Extension/WorkflowExtension.php file.
The WorkflowInterface, which is implemented by both the Workflow and TraceableWorkflow classes does not contain the getEnabledTransaction method as well.
Note that this isn't an issue in the prod environment, as the TraceableWorkflow isn't used there.
How to reproduce
Have a Symfony application with the workflow component set up, running in dev environment.
Then, call the workflow_transition() function in a twig template and render the page.
Possible Solution
The best solution would be to add the getEnabledTransition method to the WorkflowInterface and implement it in TraceableWorkflow.
However, since workflow_transitions() (plural) does work, a temporary workaround can be instead of:
…ow (alexandre-daubois)
This PR was merged into the 6.4 branch.
Discussion
----------
[Workflow] Add `getEnabledTransition()` to TraceableWorkflow
| Q | A
| ------------- | ---
| Branch? | 6.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Issues | Fix#52812
| License | MIT
I added an annotation to `WorkflowInterface` to not break BC. I think it could deserve an additional `not implementing this method is deprecated since Symfony 7.1` while upmerging (I guess ?).
Added the tests while at it.
Commits
-------
f54bc3a [Workflow] Add `getEnabledTransition()` to TraceableWorkflow
Symfony version(s) affected
6.4.0
Description
In dev environment, when using the
workflow_transition()
(not to be confused withworkflow_transactions()
) in a twig template to get a specific workflow transition, the following error occurs:This is due to the
TraceableWorkflow
, introduced in Symfony 6.4.0 not having thegetEnabledTransition
method implemented, which is implemented in the 'normal'Workflow
class. This method is called from thesymfony/twig-bridge/Extension/WorkflowExtension.php
file.The
WorkflowInterface
, which is implemented by both theWorkflow
andTraceableWorkflow
classes does not contain thegetEnabledTransaction
method as well.Note that this isn't an issue in the prod environment, as the
TraceableWorkflow
isn't used there.How to reproduce
Have a Symfony application with the workflow component set up, running in dev environment.
Then, call the
workflow_transition()
function in a twig template and render the page.Possible Solution
The best solution would be to add the
getEnabledTransition
method to theWorkflowInterface
and implement it inTraceableWorkflow
.However, since
workflow_transitions()
(plural) does work, a temporary workaround can be instead of:Doing it like this:
It's not an elegant solution, but it works.
Additional Context
No response
The text was updated successfully, but these errors were encountered: