On Tue, 16 Jun 2020 at 11:32, Peter Bowyer <phpmailingli...@gmail.com> wrote: > > If it is, how can we change and improve the current situation? >
Hi Peter, I think what I wrote earlier is still a good approach: https://externals.io/message/100773#100813 > Taking it to a better solution is that the method sqliteCreateFunction > shouldn't exist on the PDO class, but instead on a PDOSqlite that > extends PDO. > > class PDOSqlite extends PDO { > public function createFunction(...) {...} > } > > class PDO { > public static function connect(string $dsn [, string $username [, > string $password [, array $options ]]]) { > if (connecting to SQLite DB) { > return new PDOSqlite(...); > } >. // return new PDO(...); > } > } Note, I haven't done the work to actually make sure that this plan is actually feasible, so it's not guaranteed to be the correct approach. But it still sounds sensible and would scale out to other custom methods for other connection types, and avoid any magic. If you (or anyone) have the time to work on this, that would be fantastic. cheers Dan Ack -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php