diff options
author | Remi Collet <fedora@famillecollet.com> | 2010-11-01 08:05:02 +0100 |
---|---|---|
committer | Remi Collet <fedora@famillecollet.com> | 2010-11-01 08:05:02 +0100 |
commit | 7ebd0320aeaa78a74c46c5f0a1e2b7b6cd9b6568 (patch) | |
tree | 514d814bf33ee2e914aac5937d7632e48534413f | |
parent | 243f517f1fa0548b27a33e8a429a780a4a587e88 (diff) |
Improves CommonTable::__construct() : table name option is now optionnal
-rw-r--r-- | class/CommonTable.php | 5 | ||||
-rw-r--r-- | class/TablePearRepo.php | 11 | ||||
-rw-r--r-- | class/TableRRepo.php | 11 | ||||
-rw-r--r-- | class/TableUpstream.php | 11 |
4 files changed, 4 insertions, 34 deletions
diff --git a/class/CommonTable.php b/class/CommonTable.php index 7e1dd8e..ba3f7ad 100644 --- a/class/CommonTable.php +++ b/class/CommonTable.php @@ -43,8 +43,11 @@ abstract class CommonTable * @param object $db PDO instance of the DB connection * @param string $table with table name */ - function __construct(PDO $db, $table) + function __construct(PDO $db, $table='') { + if (empty($table)) { + $table = substr(strtolower(get_class($this)),5); + } $this->db = $db; $this->table = $table; diff --git a/class/TablePearRepo.php b/class/TablePearRepo.php index 34a0c17..8554fe4 100644 --- a/class/TablePearRepo.php +++ b/class/TablePearRepo.php @@ -34,17 +34,6 @@ class TablePearRepo extends CommonTable { - - /** - * Instanciate a TablePearRepo to manage pearrepo table - * - * @param object $db PDO instance of the DB connection - */ - function __construct($db) - { - parent::__construct($db, 'pearrepo'); - } - /** * Create the table and populate it with known repo * diff --git a/class/TableRRepo.php b/class/TableRRepo.php index 0eba46e..8d23082 100644 --- a/class/TableRRepo.php +++ b/class/TableRRepo.php @@ -37,17 +37,6 @@ class TableRRepo extends CommonTable { - - /** - * Instanciate a TablePearRepo to manage pearrepo table - * - * @param object $db PDO instance of the DB connection - */ - function __construct($db) - { - parent::__construct($db, 'rrepo'); - } - /** * Create the table and populate it with known repo * diff --git a/class/TableUpstream.php b/class/TableUpstream.php index 5d076c2..6630377 100644 --- a/class/TableUpstream.php +++ b/class/TableUpstream.php @@ -36,17 +36,6 @@ */ class TableUpstream extends CommonTable { - - /** - * Instanciate a TablePearRepo to manage pearrepo table - * - * @param object $db PDO instance of the DB connection - */ - function __construct($db) - { - parent::__construct($db, 'upstream'); - } - /** * Create the table and populate it with known repo * |