-
-
Save SergeR/738fe6bb58398beaf60b to your computer and use it in GitHub Desktop.
Пример действия с заказом
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @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