darkain / pudl

PHP Universal Database Library - connects to and generates queries for SQL Servers
BSD 2-Clause "Simplified" License
28 stars 5 forks source link

Allow PHP database objects in PUDL $options #9

Closed darkain closed 3 years ago

darkain commented 5 years ago

Allow PUDL to optionally take control of an existing SQL database connection. This will allow greater flexibility with existing code and frameworks to help them transition into full PUDL.

Example:

$pudl = pudl::instance([
  'server' => new mysqli([ /*CONNECTION PARAMS*/ ]);
]);

PUDL should test the object type of $options['server'] against known object types. If one is found matching an existing PUDL type, create an instance of that! This is how $options['type'] already works.

darkain commented 3 years ago

Added in: https://github.com/darkain/pudl/commit/b666dca1dd68c1a039f7db4227be780a78ecace4