Skip to content

Instantly share code, notes, and snippets.

@SergeR
Last active August 29, 2015 14:15
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
Пример действия с заказом
/**
* @param array $order
* @return array|NULL
* @throws waException
*/
private function deleteOrder($order)
{
$this->workflow = new shopWorkflow();
$actions = $this->workflow->getStateById($order['state_id'])->getActions(NULL, TRUE);
if (!isset($actions['delete'])) {
$status = $this->workflow->getStateById($order['state_id'])->getName();
throw new waException("Failed to delete order {$order['id']}. Action 'delete' is not available for order status '$status'");
}
$delete_action = $this->workflow->getActionById('delete');
if (!$delete_action) {
throw new waException("Failed to delete order {$order['id']}. getActionById('delete') fail.");
}
return $delete_action->run($order['id']);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment