Problem/Motivation

The code for checking whether transition can be applied was written before it was possible to check whether certain transitions are applicable. Given one can override workflow definition and introduce new states there's no point in hardcoding states in conditions but it's better to use the StateItemInterface::isTransitionAllowed method

Steps to reproduce

Proposed resolution

      if (in_array('mark_paid', array_keys($order->getState()
        ->getTransitions()))) {
        $order->getState()->applyTransitionById('mark_paid');
        $order->save();
      }

should become

      if ($order->getState()->isTransitionAllowed('mark_paid')) {
        $order->getState()->applyTransitionById('mark_paid');
        $order->save();
      }

Remaining tasks

User interface changes

API changes

Data model changes

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

zaporylie created an issue. See original summary.

zaporylie’s picture

Status: Active » Needs review

jsacksick made their first commit to this issue’s fork.

  • jsacksick committed ff0da35f on 8.x-1.x authored by zaporylie
    task: #3466629 Use StateItemInterface::isTransitionAllowed before...
jsacksick’s picture

Status: Needs review » Fixed

Makes sense! Merged!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.