xref: /web-bugs/src/Database/Statement.php (revision 14f8c07a)
1<?php
2
3namespace App\Database;
4
5/**
6 * PDOStatement wrapper class.
7 */
8class Statement extends \PDOStatement
9{
10    /**
11     * This allows chaining execute() method:
12     *   $db->query('SELECT a FROM b WHERE c = ?')->execute('foo')->fetch();
13     * \PDOStatement::execute(), on the other hand, returns boolean. Change it
14     * to return $this and thus allow further method chaining.
15     */
16    public function execute($parameters = null): self
17    {
18        parent::execute($parameters);
19
20        return $this;
21    }
22}
23