Total Complexity | 9 |
Total Lines | 58 |
Duplicated Lines | 0 % |
Changes | 3 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
7 | class View extends DatabaseItem implements Changeable, Initializable |
||
8 | { |
||
9 | private $name; |
||
10 | private $schema; |
||
11 | |||
12 | public $definition; |
||
13 | |||
14 | public function __construct($name, $schema) |
||
15 | { |
||
16 | $this->name = $name; |
||
17 | $this->schema = $schema; |
||
18 | } |
||
19 | |||
20 | #[\Override] |
||
21 | public function initialize(): void |
||
22 | { |
||
23 | $this->definition = $this->getChangeLogger()->doesViewExist($this->buildDescription()); |
||
|
|||
24 | if($this->definition === false) |
||
25 | { |
||
26 | $this->new = true; |
||
27 | } |
||
28 | } |
||
29 | |||
30 | public function drop() |
||
31 | { |
||
32 | $this->getChangeLogger()->dropView($this->buildDescription()); |
||
33 | return $this; |
||
34 | } |
||
35 | |||
36 | public function definition($definition) |
||
37 | { |
||
38 | $this->addChange('definition', 'definition', $definition); |
||
39 | |||
40 | if($this->isNew()) |
||
41 | { |
||
42 | $this->getChangeLogger()->addView($this->buildDescription()); |
||
43 | } |
||
44 | return $this; |
||
45 | } |
||
46 | |||
47 | public function view($name) |
||
51 | } |
||
52 | |||
53 | public function table($name) |
||
57 | } |
||
58 | |||
59 | #[\Override] |
||
60 | public function buildDescription() { |
||
65 | ); |
||
66 | } |
||
68 |