Preview:
$pr = \Drupal::entityTypeManager()->getStorage('cfp_payment_request')->load(4221);
$pr->setAmountDedicatedToAp(NULL);
$pr->set('date_of_completion', NULL);
$pr->setState('under_approval');
$pr->save();


$transition_history = $pr->get('transition_history')->getValue();
array_splice($transition_history, -2);
$pr->set('transition_history', $transition_history);
$pr->set('items_approvement_closed', FALSE);
$pr->save();
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter