1
|
|
|
<?php declare (strict_types = 1); |
2
|
|
|
|
3
|
|
|
namespace Limoncello\Data\Migrations; |
4
|
|
|
|
5
|
|
|
/** |
6
|
|
|
* Copyright 2015-2019 [email protected] |
7
|
|
|
* |
8
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
9
|
|
|
* you may not use this file except in compliance with the License. |
10
|
|
|
* You may obtain a copy of the License at |
11
|
|
|
* |
12
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0 |
13
|
|
|
* |
14
|
|
|
* Unless required by applicable law or agreed to in writing, software |
15
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, |
16
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
17
|
|
|
* See the License for the specific language governing permissions and |
18
|
|
|
* limitations under the License. |
19
|
|
|
*/ |
20
|
|
|
|
21
|
|
|
use Limoncello\Contracts\Data\ModelSchemaInfoInterface; |
22
|
|
|
use Limoncello\Data\Contracts\MigrationContextInterface; |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* @package Limoncello\Data |
26
|
|
|
*/ |
27
|
|
|
class MigrationContext implements MigrationContextInterface |
28
|
|
|
{ |
29
|
|
|
/** |
30
|
|
|
* @var string |
31
|
|
|
*/ |
32
|
|
|
private $modelClass; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* @var ModelSchemaInfoInterface |
36
|
|
|
*/ |
37
|
|
|
private $modelSchemas; |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* @param string $modelClass |
41
|
|
|
* @param ModelSchemaInfoInterface $modelSchemas |
42
|
|
|
*/ |
43
|
2 |
|
public function __construct(string $modelClass, ModelSchemaInfoInterface $modelSchemas) |
44
|
|
|
{ |
45
|
2 |
|
$this->modelClass = $modelClass; |
46
|
2 |
|
$this->modelSchemas = $modelSchemas; |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* @return string |
51
|
|
|
*/ |
52
|
2 |
|
public function getModelClass(): string |
53
|
|
|
{ |
54
|
2 |
|
return $this->modelClass; |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* @return ModelSchemaInfoInterface |
59
|
|
|
*/ |
60
|
2 |
|
public function getModelSchemas(): ModelSchemaInfoInterface |
61
|
|
|
{ |
62
|
2 |
|
return $this->modelSchemas; |
63
|
|
|
} |
64
|
|
|
} |
65
|
|
|
|