protected function insertState(Identifier $identifier, $state, $message = null)
{
$connection = $this->getConnection();
$prefix = $this->getPrefix();
try {
$query = 'INSERT INTO ' . $prefix . 'statemachine_entities
(machine, entity_id, state, changetime)
VALUES
(:machine, :entity_id, :state, :timestamp)';
$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 inserting state failed: [%s]', $e->getMessage()), Exception::PERSISTENCE_LAYER_EXCEPTION);
}
}