From e6fca943f669dcf550dd981f5548b9478d213c50 Mon Sep 17 00:00:00 2001 From: Dominique Fournier Date: Fri, 21 Aug 2015 12:08:20 +0000 Subject: [PATCH] dblayer : define the setters of properties to allow chained -> git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@2269 bf3deb0d-5f1a-0410-827f-c0cc1f45334c --- dblayer.php | 82 ++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 75 insertions(+), 7 deletions(-) diff --git a/dblayer.php b/dblayer.php index 8acd339..1d59331 100644 --- a/dblayer.php +++ b/dblayer.php @@ -51,13 +51,6 @@ class dblayer public $unique = null; /** An array to define the foreign keys of the field */ public $foreign = array (); - /** The verify unitary stack - @param string $field The name of the field to test - @param string $val The value of the field to test */ - public function verifyOne ($field, $val) {} - /** The verify global stack - @param array $datas The associative array of contents */ - public function verifyAll ($datas) {} /** Debug of the SQL */ public $debug = FALSE; /** The connecting DSN */ @@ -67,6 +60,14 @@ class dblayer /** Titles */ public $titles = array (); + /** The verify unitary stack + @param string $field The name of the field to test + @param string $val The value of the field to test */ + public function verifyOne ($field, $val) {} + /** The verify global stack + @param array $datas The associative array of contents */ + public function verifyAll ($datas) {} + // TODO !! /** Create Table creation from $this->fields with engine abstraction Example in sqlite3 id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, @@ -1398,6 +1399,73 @@ class dblayer { return $nbLinesDeleted; } + + /////////////////// + /// SETTERS /// + /////////////////// + /** Set the table property */ + public function tableSet ($table) + { + $this->table = $table; + return $this; + } + + /** Set the tableprefix property */ + public function tableprefixSet ($tableprefix) + { + $this->tableprefix = $tableprefix; + return $this; + } + + /** Set the fields property */ + public function fieldsSet ($fields) + { + $this->fields = $fields; + return $this; + } + + /** Set the primary property */ + public function primarySet ($primary) + { + $this->primary = $primary; + return $this; + } + + /** Set the unique property */ + public function uniqueSet ($unique) + { + $this->unique = $unique; + return $this; + } + + /** Set the foreign property */ + public function foreignSet ($foreign) + { + $this->foreign = $foreign; + return $this; + } + + /** Set the debug property */ + public function debugSet ($debug) + { + $this->debug = $debug; + return $this; + } + + /** Set the dsn property */ + public function dsnSet ($dsn) + { + $this->dsn = $dsn; + return $this; + } + + /** Set the titles property */ + public function titlesSet ($titles) + { + $this->titles = $titles; + return $this; + } + } /** POC :