1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace Yiisoft\Yii\Cycle\Command; |
6
|
|
|
|
7
|
|
|
use Cycle\ORM\ORMInterface; |
8
|
|
|
use Cycle\ORM\SchemaInterface; |
9
|
|
|
use Psr\Container\ContainerInterface; |
10
|
|
|
use Spiral\Database\DatabaseProviderInterface; |
11
|
|
|
use Spiral\Migrations\Config\MigrationConfig; |
12
|
|
|
use Spiral\Migrations\Migrator; |
13
|
|
|
use Yiisoft\Yii\Cycle\Schema\SchemaConveyorInterface; |
14
|
|
|
use Yiisoft\Yii\Cycle\Schema\SchemaManager; |
15
|
|
|
use Yiisoft\Yii\Cycle\Schema\SchemaProviderInterface; |
16
|
|
|
|
17
|
|
|
final class CycleDependencyProxy |
18
|
|
|
{ |
19
|
|
|
private ContainerInterface $container; |
20
|
|
|
public function __construct(ContainerInterface $container) |
21
|
|
|
{ |
22
|
|
|
$this->container = $container; |
23
|
|
|
} |
24
|
|
|
public function getDatabaseProvider(): DatabaseProviderInterface |
25
|
|
|
{ |
26
|
|
|
return $this->container->get(DatabaseProviderInterface::class); |
27
|
|
|
} |
28
|
|
|
public function getMigrationConfig(): MigrationConfig |
29
|
|
|
{ |
30
|
|
|
return $this->container->get(MigrationConfig::class); |
31
|
|
|
} |
32
|
|
|
public function getMigrator(): Migrator |
33
|
|
|
{ |
34
|
|
|
return $this->container->get(Migrator::class); |
35
|
|
|
} |
36
|
|
|
/** |
37
|
|
|
* Can be used in other packages |
38
|
|
|
*/ |
39
|
|
|
public function getORM(): ORMInterface |
40
|
|
|
{ |
41
|
|
|
return $this->container->get(ORMInterface::class); |
42
|
|
|
} |
43
|
|
|
public function getSchema(): SchemaInterface |
44
|
|
|
{ |
45
|
|
|
return $this->container->get(SchemaInterface::class); |
46
|
|
|
} |
47
|
|
|
/** |
48
|
|
|
* @deprecated {@see getSchemaProvider} |
49
|
|
|
*/ |
50
|
|
|
public function getSchemaManager(): SchemaManager |
51
|
|
|
{ |
52
|
|
|
return $this->container->get(SchemaManager::class); |
53
|
|
|
} |
54
|
|
|
public function getSchemaProvider(): SchemaProviderInterface |
55
|
|
|
{ |
56
|
|
|
return $this->container->get(SchemaProviderInterface::class); |
57
|
|
|
} |
58
|
|
|
public function getSchemaConveyor(): SchemaConveyorInterface |
59
|
|
|
{ |
60
|
|
|
return $this->container->get(SchemaConveyorInterface::class); |
61
|
|
|
} |
62
|
|
|
} |
63
|
|
|
|