1 | <?php |
||
5 | class AdapterFactory |
||
6 | { |
||
7 | |||
8 | /** |
||
9 | * Create adapter from an existing doctrine/dbal connection |
||
10 | * |
||
11 | * @param \Illuminate\Database\Capsule\Manager $capsule |
||
12 | * @return \Soluble\DbWrapper\Adapter\Illuminate\Capsule5Adapter |
||
13 | */ |
||
14 | |||
15 | 1 | public static function createAdapterFromCapsule5(\Illuminate\Database\Capsule\Manager $capsule) |
|
19 | |||
20 | /** |
||
21 | * Create adapter from an existing doctrine/dbal connection |
||
22 | * |
||
23 | * @param \Doctrine\DBAL\Connection $dbalConnection |
||
24 | * @return \Soluble\DbWrapper\Adapter\Doctrine\Dbal2Adapter |
||
25 | */ |
||
26 | |||
27 | 1 | public static function createAdapterFromDoctrine2(\Doctrine\DBAL\Connection $dbalConnection) |
|
28 | { |
||
29 | 1 | return new \Soluble\DbWrapper\Adapter\Doctrine\Dbal2Adapter($dbalConnection); |
|
30 | } |
||
31 | |||
32 | |||
33 | /** |
||
34 | * Create adapter from an existing zendframework/zend-db adapter |
||
35 | * |
||
36 | * @param \Zend\Db\Adapter\Adapter $zendAdapter |
||
37 | * @return \Soluble\DbWrapper\Adapter\Zend\ZendDb2Adapter |
||
38 | */ |
||
39 | |||
40 | 1 | public static function createAdapterFromZendDb2(\Zend\Db\Adapter\Adapter $zendAdapter) |
|
44 | |||
45 | /** |
||
46 | * Create adapter from an existing connection resource |
||
47 | * |
||
48 | * @param mixed $resource database connection object (mysqli, pdo_mysql,...) |
||
49 | * @throws Exception\InvalidArgumentException |
||
50 | * @throws Exception\UnsupportedDriverException |
||
51 | * @return Adapter\AdapterInterface |
||
52 | */ |
||
53 | 5 | public static function createAdapterFromResource($resource) |
|
66 | |||
67 | |||
68 | /** |
||
69 | * Get an adapter from an existing connection resource |
||
70 | * |
||
71 | * @param \PDO $resource database connection object |
||
72 | * @throws Exception\UnsupportedDriverException |
||
73 | * @return Adapter\AdapterInterface |
||
74 | */ |
||
75 | 2 | protected static function getAdapterFromPdo(\PDO $resource) |
|
92 | } |
||
93 |