Prooph\EventStore\EventStore::transactional PHP Method

transactional() public method

public transactional ( callable $callable ) : mixed
$callable callable
return mixed
    public function transactional(callable $callable)
    {
        $this->beginTransaction();
        try {
            $result = $callable($this);
            $this->commit();
        } catch (\Exception $e) {
            $this->rollback();
            throw $e;
        }
        return $result ?: true;
    }