From 029bb0beb57c7aed4714a10c4808c4f22f7044b3 Mon Sep 17 00:00:00 2001 From: Dominique Fournier Date: Tue, 2 May 2017 09:57:40 +0000 Subject: [PATCH] dblayeroo: allow to extends it. Add a connect class instead of the constructor git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@3561 bf3deb0d-5f1a-0410-827f-c0cc1f45334c --- dblayeroo.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/dblayeroo.php b/dblayeroo.php index 11fd341..5640a43 100644 --- a/dblayeroo.php +++ b/dblayeroo.php @@ -57,6 +57,19 @@ class dblayeroo */ public function __construct ($dsn, $username=null, $password=null, $driver_options=null) + { + $this->connect ($dsn, $username, $password, $driver_options); + } + + /** Connection to the database engine + * See http://fr2.php.net/manual/en/pdo.construct.php for the $dsn format + * @param string $dsn PDO Data Source Name + * @param string|null $username Username to connect + * @param string|null $password Password to connect + * @param string|null $driver_options Driver options to the database + */ + public function connect ($dsn, $username=null, $password=null, + $driver_options=null) /* {{{ */ { $driver = @explode (":", $dsn); @@ -1306,7 +1319,7 @@ class dblayeroo $this->debugLog ("Entering setForeignObj (OBJECT)"); if (! is_object ($object)) $this->DBException ("Invalid setForeignObj parameter: not an object"); - if (get_class ($object) !== __CLASS__) + if (! is_subclass_of ($object, __CLASS__)) $this->DBException ( "Invalid object provided to setForeignObj (not dblayeroo object)"); if (! isset ($object->table))