@@ -2,9 +2,9 @@ |
||
2 | 2 | |
3 | 3 | namespace Opeyemiabiodun\PotatoORM\Connections; |
4 | 4 | |
5 | +use Opeyemiabiodun\PotatoORM\Connections\Connection; |
|
5 | 6 | use PDO; |
6 | 7 | use PDOException; |
7 | -use Opeyemiabiodun\PotatoORM\Connections\Connection; |
|
8 | 8 | |
9 | 9 | final class MySqlConnection extends Connection |
10 | 10 | { |
@@ -12,9 +12,9 @@ |
||
12 | 12 | { |
13 | 13 | $this->useDbEnv(); |
14 | 14 | |
15 | - $dsn = 'mysql:host='.$this->_host |
|
16 | - .';port='.$this->_port |
|
17 | - .';dbname='.$this->_database; |
|
15 | + $dsn = 'mysql:host=' . $this->_host |
|
16 | + .';port=' . $this->_port |
|
17 | + .';dbname=' . $this->_database; |
|
18 | 18 | |
19 | 19 | try { |
20 | 20 | $this->_pdo = new PDO($dsn, $this->_username, $this->_password); |
@@ -2,9 +2,9 @@ |
||
2 | 2 | |
3 | 3 | namespace Opeyemiabiodun\PotatoORM\Connections; |
4 | 4 | |
5 | +use Opeyemiabiodun\PotatoORM\Connections\Connection; |
|
5 | 6 | use PDO; |
6 | 7 | use PDOException; |
7 | -use Opeyemiabiodun\PotatoORM\Connections\Connection; |
|
8 | 8 | |
9 | 9 | final class PgSqlConnection extends Connection |
10 | 10 | { |
@@ -12,11 +12,11 @@ |
||
12 | 12 | { |
13 | 13 | $this->useDbEnv(); |
14 | 14 | |
15 | - $dsn = 'pgsql:host='.$this->_host |
|
16 | - .';port='.$this->_port |
|
17 | - .';dbname='.$this->_database |
|
18 | - .';user='.$this->_username |
|
19 | - .';password='.$this->_password; |
|
15 | + $dsn = 'pgsql:host=' . $this->_host |
|
16 | + .';port=' . $this->_port |
|
17 | + .';dbname=' . $this->_database |
|
18 | + .';user=' . $this->_username |
|
19 | + .';password=' . $this->_password; |
|
20 | 20 | |
21 | 21 | try { |
22 | 22 | $this->_pdo = new PDO($dsn); |
@@ -34,7 +34,7 @@ |
||
34 | 34 | |
35 | 35 | protected function loadDbEnv() |
36 | 36 | { |
37 | - $dotenv = new Dotenv(__DIR__.'/..'); |
|
37 | + $dotenv = new Dotenv(__DIR__ . '/..'); |
|
38 | 38 | $dotenv->required(['DB_HOST', 'DB_DATABASE', 'DB_USERNAME', 'DB_PASSWORD', 'DB_PORT'])->notEmpty(); |
39 | 39 | $dotenv->load(); |
40 | 40 |
@@ -4,7 +4,7 @@ |
||
4 | 4 | |
5 | 5 | class Model |
6 | 6 | { |
7 | - private static $modelCollection = []; |
|
7 | + private static $modelCollection = []; |
|
8 | 8 | |
9 | 9 | public function __construct() |
10 | 10 | { |
@@ -4,28 +4,28 @@ |
||
4 | 4 | |
5 | 5 | final class SqlTransactions extends Transactions |
6 | 6 | { |
7 | - public function createRecord($tableName, $record) |
|
8 | - { |
|
7 | + public function createRecord($tableName, $record) |
|
8 | + { |
|
9 | 9 | |
10 | - } |
|
10 | + } |
|
11 | 11 | |
12 | - public function readRecord($tableName, $id) |
|
13 | - { |
|
12 | + public function readRecord($tableName, $id) |
|
13 | + { |
|
14 | 14 | |
15 | - } |
|
15 | + } |
|
16 | 16 | |
17 | - public function updateRecord($tableName, $id, $record) |
|
18 | - { |
|
17 | + public function updateRecord($tableName, $id, $record) |
|
18 | + { |
|
19 | 19 | |
20 | - } |
|
20 | + } |
|
21 | 21 | |
22 | - public function deleteRecord($tableName, $id) |
|
23 | - { |
|
22 | + public function deleteRecord($tableName, $id) |
|
23 | + { |
|
24 | 24 | |
25 | - } |
|
25 | + } |
|
26 | 26 | |
27 | - public function readAllRecords($tableName) |
|
28 | - { |
|
27 | + public function readAllRecords($tableName) |
|
28 | + { |
|
29 | 29 | |
30 | - } |
|
30 | + } |
|
31 | 31 | } |
32 | 32 | \ No newline at end of file |
@@ -6,25 +6,25 @@ |
||
6 | 6 | |
7 | 7 | abstract class Transactions |
8 | 8 | { |
9 | - protected $_connection; |
|
9 | + protected $_connection; |
|
10 | 10 | |
11 | - protected function __construct(Connection $connection) |
|
12 | - { |
|
13 | - $this->_connection = $connection; |
|
14 | - } |
|
11 | + protected function __construct(Connection $connection) |
|
12 | + { |
|
13 | + $this->_connection = $connection; |
|
14 | + } |
|
15 | 15 | |
16 | - public static function on(Connection $connection) |
|
17 | - { |
|
18 | - return new Transaction($connection); |
|
19 | - } |
|
16 | + public static function on(Connection $connection) |
|
17 | + { |
|
18 | + return new Transaction($connection); |
|
19 | + } |
|
20 | 20 | |
21 | - abstract public function createRecord($tableName, $record); |
|
21 | + abstract public function createRecord($tableName, $record); |
|
22 | 22 | |
23 | - abstract public function readRecord($tableName, $id); |
|
23 | + abstract public function readRecord($tableName, $id); |
|
24 | 24 | |
25 | - abstract public function updateRecord($tableName, $id, $record); |
|
25 | + abstract public function updateRecord($tableName, $id, $record); |
|
26 | 26 | |
27 | - abstract public function deleteRecord($tableName, $id); |
|
27 | + abstract public function deleteRecord($tableName, $id); |
|
28 | 28 | |
29 | - abstract public function readAllRecords($tableName); |
|
29 | + abstract public function readAllRecords($tableName); |
|
30 | 30 | } |
31 | 31 | \ No newline at end of file |