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
Issue fork commerce_recurring-3466629
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
Comment #3
zaporylieComment #6
jsacksick commentedMakes sense! Merged!