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