File tree Expand file tree Collapse file tree 12 files changed +48
-9
lines changed
Expand file tree Collapse file tree 12 files changed +48
-9
lines changed Original file line number Diff line number Diff line change 1313use Utopia \Database \Adapter \Mongo ;
1414use Utopia \Database \Adapter \MySQL ;
1515use Utopia \Database \Database ;
16+ use Utopia \Database \PDO ;
1617use Utopia \Mongo \Client ;
1718use Utopia \Validator \Text ;
1819
Original file line number Diff line number Diff line change 2020use Utopia \Database \Document ;
2121use Utopia \Database \Helpers \Permission ;
2222use Utopia \Database \Helpers \Role ;
23+ use Utopia \Database \PDO ;
2324use Utopia \Database \Validator \Authorization ;
2425use Utopia \Mongo \Client ;
2526use Utopia \Validator \Numeric ;
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Utopia \Database ;
4+
5+ class PDO
6+ {
7+ protected \PDO $ pdo ;
8+
9+ public function __construct (
10+ protected string $ dsn ,
11+ protected ?string $ username ,
12+ protected ?string $ password ,
13+ protected array $ config = []
14+ ) {
15+ $ this ->pdo = new \PDO (
16+ $ this ->dsn ,
17+ $ this ->username ,
18+ $ this ->password ,
19+ $ this ->config
20+ );
21+ }
22+
23+ public function __call (string $ method , array $ args ): mixed
24+ {
25+ return $ this ->pdo ->{$ method }(...$ args );
26+ }
27+
28+ public function reconnect (): void
29+ {
30+ $ this ->pdo = new \PDO (
31+ $ this ->dsn ,
32+ $ this ->username ,
33+ $ this ->password ,
34+ $ this ->config
35+ );
36+ }
37+ }
Original file line number Diff line number Diff line change 22
33namespace Tests \E2E \Adapter ;
44
5- use PDO ;
65use Redis ;
76use Utopia \Cache \Adapter \Redis as RedisAdapter ;
87use Utopia \Cache \Cache ;
98use Utopia \Database \Adapter \MariaDB ;
109use Utopia \Database \Database ;
10+ use Utopia \Database \PDO ;
1111
1212class MariaDBTest extends Base
1313{
Original file line number Diff line number Diff line change 22
33namespace Tests \E2E \Adapter ;
44
5- use PDO ;
65use Redis ;
76use Utopia \Cache \Adapter \Redis as RedisAdapter ;
87use Utopia \Cache \Cache ;
1817use Utopia \Database \Helpers \Permission ;
1918use Utopia \Database \Helpers \Role ;
2019use Utopia \Database \Mirror ;
20+ use Utopia \Database \PDO ;
2121
2222class MirrorTest extends Base
2323{
Original file line number Diff line number Diff line change 22
33namespace Tests \E2E \Adapter ;
44
5- use PDO ;
65use Redis ;
76use Utopia \Cache \Adapter \Redis as RedisAdapter ;
87use Utopia \Cache \Cache ;
98use Utopia \Database \Adapter \MySQL ;
109use Utopia \Database \Database ;
10+ use Utopia \Database \PDO ;
1111
1212class MySQLTest extends Base
1313{
Original file line number Diff line number Diff line change 22
33namespace Tests \E2E \Adapter ;
44
5- use PDO ;
65use Redis ;
76use Utopia \Cache \Adapter \Redis as RedisAdapter ;
87use Utopia \Cache \Cache ;
98use Utopia \Database \Adapter \Postgres ;
109use Utopia \Database \Database ;
10+ use Utopia \Database \PDO ;
1111
1212class PostgresTest extends Base
1313{
Original file line number Diff line number Diff line change 22
33namespace Tests \E2E \Adapter ;
44
5- use PDO ;
65use Redis ;
76use Utopia \Cache \Adapter \Redis as RedisAdapter ;
87use Utopia \Cache \Cache ;
98use Utopia \Database \Adapter \SQLite ;
109use Utopia \Database \Database ;
10+ use Utopia \Database \PDO ;
1111
1212class SQLiteTest extends Base
1313{
Original file line number Diff line number Diff line change 22
33namespace Tests \E2E \Adapter \SharedTables ;
44
5- use PDO ;
65use Redis ;
76use Tests \E2E \Adapter \Base ;
87use Utopia \Cache \Adapter \Redis as RedisAdapter ;
98use Utopia \Cache \Cache ;
109use Utopia \Database \Adapter \MariaDB ;
1110use Utopia \Database \Database ;
11+ use Utopia \Database \PDO ;
1212
1313class MariaDBTest extends Base
1414{
Original file line number Diff line number Diff line change 22
33namespace Tests \E2E \Adapter \SharedTables ;
44
5- use PDO ;
65use Redis ;
76use Tests \E2E \Adapter \Base ;
87use Utopia \Cache \Adapter \Redis as RedisAdapter ;
98use Utopia \Cache \Cache ;
109use Utopia \Database \Adapter \MySQL ;
1110use Utopia \Database \Database ;
11+ use Utopia \Database \PDO ;
1212
1313class MySQLTest extends Base
1414{
You can’t perform that action at this time.
0 commit comments