-
Notifications
You must be signed in to change notification settings - Fork 3
/
Orm.php
45 lines (37 loc) · 904 Bytes
/
Orm.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
declare(strict_types=1);
/*
* Studio 107 (c) 2018 Maxim Falaleev
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Mindy\Orm;
use Doctrine\DBAL\Connection;
use Mindy\Application\App;
class Orm
{
/**
* @var Connection
*/
protected static $connection;
/**
* @param Connection $connection
*/
public static function setDefaultConnection(Connection $connection)
{
self::$connection = $connection;
}
/**
* @return Connection|null
*/
public static function getDefaultConnection()
{
if (null === self::$connection) {
self::$connection = App::getInstance()
->getComponent('orm.connection_manager')
->getConnection('default');
}
return self::$connection;
}
}