protected function updateState(Identifier $identifier, $state, $message = null)
{
$connection = $this->getConnection();
$prefix = $this->getPrefix();
try {
$query = 'UPDATE ' . $prefix . 'statemachine_entities SET state = :state,
changetime = :timestamp WHERE entity_id = :entity_id
AND machine = :machine';
$statement = $connection->prepare($query);
$machine = $identifier->getMachine();
$entity_id = $identifier->getEntityId();
$timestamp = $this->getTimestampForDriver();
$statement->bindParam(":machine", $machine);
$statement->bindParam(":entity_id", $entity_id);
$statement->bindParam(":state", $state);
$statement->bindParam(":timestamp", $timestamp);
$result = $statement->execute();
if ($result === false) {
throw new Exception($this->getErrorInfo($statement));
}
} catch (\Exception $e) {
throw new Exception(sprintf('query for updating state failed: [%s]', $e->getMessage()), Exception::PERSISTENCE_LAYER_EXCEPTION);
}
}