@@ -4,11 +4,11 @@ |
||
| 4 | 4 | |
| 5 | 5 | class DatabaseConnectionStringFactoryTest extends PHPUnit_Framework_TestCase |
| 6 | 6 | { |
| 7 | - /** |
|
| 8 | - * The instance of DatabaseConnectionStringFactory used in the test. |
|
| 9 | - * |
|
| 10 | - * @var Pyjac\ORM\DatabaseConnectionStringFactory |
|
| 11 | - */ |
|
| 7 | + /** |
|
| 8 | + * The instance of DatabaseConnectionStringFactory used in the test. |
|
| 9 | + * |
|
| 10 | + * @var Pyjac\ORM\DatabaseConnectionStringFactory |
|
| 11 | + */ |
|
| 12 | 12 | protected $openSourceEvangelistFactory; |
| 13 | 13 | |
| 14 | 14 | /** |
@@ -10,28 +10,28 @@ discard block |
||
| 10 | 10 | |
| 11 | 11 | /** |
| 12 | 12 | * Store instance of database connection used. |
| 13 | - * @var [type] |
|
| 14 | - */ |
|
| 13 | + * @var [type] |
|
| 14 | + */ |
|
| 15 | 15 | protected $databaseConnection; |
| 16 | 16 | |
| 17 | - public function __construct() |
|
| 17 | + public function __construct() |
|
| 18 | 18 | { |
| 19 | 19 | $this->databaseConnection = DatabaseConnection::getInstance()->databaseConnection; |
| 20 | 20 | //$databaseConnection->databaseConnection->connect(); |
| 21 | 21 | } |
| 22 | 22 | /** |
| 23 | - * @param string $key rep column name |
|
| 24 | - * @param string $val rep column value |
|
| 25 | - * sets into $propertie the $key => $value pairs |
|
| 26 | - */ |
|
| 23 | + * @param string $key rep column name |
|
| 24 | + * @param string $val rep column value |
|
| 25 | + * sets into $propertie the $key => $value pairs |
|
| 26 | + */ |
|
| 27 | 27 | public function __set($key, $val) |
| 28 | 28 | { |
| 29 | 29 | $this->properties[$key] = $val; |
| 30 | 30 | } |
| 31 | 31 | /** |
| 32 | - * @param string $key reps the column name |
|
| 33 | - * @return $key and $value |
|
| 34 | - */ |
|
| 32 | + * @param string $key reps the column name |
|
| 33 | + * @return $key and $value |
|
| 34 | + */ |
|
| 35 | 35 | public function __get($key) |
| 36 | 36 | { |
| 37 | 37 | return $this->properties[$key]; |
@@ -41,17 +41,17 @@ discard block |
||
| 41 | 41 | * |
| 42 | 42 | * @return array |
| 43 | 43 | */ |
| 44 | - public function getProperties() |
|
| 45 | - { |
|
| 46 | - return $this->properties; |
|
| 47 | - } |
|
| 44 | + public function getProperties() |
|
| 45 | + { |
|
| 46 | + return $this->properties; |
|
| 47 | + } |
|
| 48 | 48 | /** |
| 49 | - * Gets the name of the child class only |
|
| 50 | - * without the namespace |
|
| 51 | - * @var $className |
|
| 52 | - * @var $table |
|
| 53 | - * @return $table |
|
| 54 | - */ |
|
| 49 | + * Gets the name of the child class only |
|
| 50 | + * without the namespace |
|
| 51 | + * @var $className |
|
| 52 | + * @var $table |
|
| 53 | + * @return $table |
|
| 54 | + */ |
|
| 55 | 55 | public function getTableName() |
| 56 | 56 | { |
| 57 | 57 | $className = explode('\\', get_called_class()); |
@@ -59,11 +59,11 @@ discard block |
||
| 59 | 59 | return $table; |
| 60 | 60 | } |
| 61 | 61 | /** |
| 62 | - * returns a particular record |
|
| 63 | - * @param $id reps the record id |
|
| 64 | - * @param $connection initialised to null |
|
| 65 | - * @return object |
|
| 66 | - */ |
|
| 62 | + * returns a particular record |
|
| 63 | + * @param $id reps the record id |
|
| 64 | + * @param $connection initialised to null |
|
| 65 | + * @return object |
|
| 66 | + */ |
|
| 67 | 67 | public static function find($id) |
| 68 | 68 | { |
| 69 | 69 | $model = new static; |
@@ -71,11 +71,11 @@ discard block |
||
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | /** |
| 74 | - * returns a particular record |
|
| 75 | - * @param $id reps the record id |
|
| 76 | - * @param $connection initialised to null |
|
| 77 | - * @return object |
|
| 78 | - */ |
|
| 74 | + * returns a particular record |
|
| 75 | + * @param $id reps the record id |
|
| 76 | + * @param $connection initialised to null |
|
| 77 | + * @return object |
|
| 78 | + */ |
|
| 79 | 79 | public function get($id) |
| 80 | 80 | { |
| 81 | 81 | $sql = "SELECT * FROM {$this->getTableName()} WHERE id={$id}"; |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | * Update the model in the database. |
| 108 | 108 | * |
| 109 | 109 | * @return int |
| 110 | - */ |
|
| 110 | + */ |
|
| 111 | 111 | private function update() |
| 112 | 112 | { |
| 113 | 113 | |
@@ -130,10 +130,10 @@ discard block |
||
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | /** |
| 133 | - * Insert the model values into the database. |
|
| 134 | - * |
|
| 135 | - * @return int |
|
| 136 | - */ |
|
| 133 | + * Insert the model values into the database. |
|
| 134 | + * |
|
| 135 | + * @return int |
|
| 136 | + */ |
|
| 137 | 137 | private function create() |
| 138 | 138 | { |
| 139 | 139 | |
@@ -168,11 +168,11 @@ discard block |
||
| 168 | 168 | return $this->id ? $this->update() : $this->create(); |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | - /** |
|
| 172 | - * Delete a model from the database. |
|
| 173 | - * @param int $id |
|
| 174 | - * @return boolean |
|
| 175 | - */ |
|
| 171 | + /** |
|
| 172 | + * Delete a model from the database. |
|
| 173 | + * @param int $id |
|
| 174 | + * @return boolean |
|
| 175 | + */ |
|
| 176 | 176 | public static function destroy($id) |
| 177 | 177 | { |
| 178 | 178 | $model = new static; |