public function getTransitions($machine)
{
$connection = $this->getConnection();
$prefix = $this->getPrefix();
$query = 'SELECT st.machine,
st.state_from AS state_from, st.state_to AS state_to,
st.rule, st.command,
ss_to.type AS state_to_type,
ss_to.exit_command as state_to_exit_command,
ss_to.entry_command as state_to_entry_command,
ss.type AS state_from_type,
ss.exit_command as state_from_exit_command,
ss.entry_command as state_from_entry_command,
st.priority,
ss.description AS state_from_description,
ss_to.description AS state_to_description,
st.description AS transition_description,
st.event
FROM ' . $prefix . 'statemachine_transitions AS st
LEFT JOIN
' . $prefix . 'statemachine_states AS ss
ON (st.state_from = ss.state AND st.machine = ss.machine)
LEFT JOIN
' . $prefix . 'statemachine_states AS ss_to
ON (st.state_to = ss_to.state AND st.machine = ss_to.machine)
WHERE
st.machine = :machine
ORDER BY
st.state_from ASC, st.priority ASC, st.state_to ASC';
try {
$statement = $connection->prepare($query);
$statement->bindParam(":machine", $machine);
$result = $statement->execute();
if ($result === false) {
throw new Exception($this->getErrorInfo($statement));
}
$rows = $statement->fetchAll();
} catch (\Exception $e) {
throw new Exception($e->getMessage(), Exception::PERSISTENCE_LAYER_EXCEPTION, $e);
}
return $rows;
}