Skip to content

Instantly share code, notes, and snippets.

@mmasiukevich
Created May 15, 2019 18:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mmasiukevich/722f87f6ec657a00b782cb646233dec0 to your computer and use it in GitHub Desktop.
Save mmasiukevich/722f87f6ec657a00b782cb646233dec0 to your computer and use it in GitHub Desktop.
    public function someMethod(DatabaseAdapter $adapter): Promise
    {
        return call(
            static function() use ($adapter): \Generator
            {
                yield $adapter->transactional(
                    static function(QueryExecutor $queryExecutor): \Generator
                    {
                        yield $queryExecutor->execute('SELECT NOW()');
                    }
                );
            }
        );
    }
    
    ```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment