Skip to content

Instantly share code, notes, and snippets.

@mmasiukevich
Created May 15, 2019 17:36
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mmasiukevich/b7484b90a01046df4919dbf1c99912b9 to your computer and use it in GitHub Desktop.
Save mmasiukevich/b7484b90a01046df4919dbf1c99912b9 to your computer and use it in GitHub Desktop.
    public function qwerty(DatabaseAdapter $adapter): \Generator
    {
        /** @var array|null $customerInfo */
        $customerInfo = yield fetchOne(
            yield $adapter->execute('SELECT * FROM customers WHERE id = ?', [10])
        );

        if(null === $customerInfo)
        {
            $sequence = yield fetchOne(
                yield $adapter->execute('SELECT nextval(\'serial\')')
            );

            print_r($sequence['nextval']);
        }

        print_r($customerInfo);
    }
    ```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment