1 | <?php |
||||||
2 | namespace yentu\database; |
||||||
3 | |||||||
4 | |||||||
5 | class Schema extends DatabaseItem implements Changeable, Initializable |
||||||
6 | { |
||||||
7 | private string $name; |
||||||
8 | private bool $isReference; |
||||||
9 | |||||||
10 | public function __construct(string $name) |
||||||
11 | { |
||||||
12 | $this->name = $name; |
||||||
13 | } |
||||||
14 | |||||||
15 | #[\Override] |
||||||
16 | public function initialize(): void |
||||||
17 | { |
||||||
18 | if(!$this->getChangeLogger()->doesSchemaExist($this->name)) { |
||||||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||||||
19 | $this->getChangeLogger()->addSchema($this->name); |
||||||
0 ignored issues
–
show
The method
addSchema() does not exist on yentu\ChangeLogger . Since you implemented __call , consider adding a @method annotation.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
20 | } |
||||||
21 | } |
||||||
22 | |||||||
23 | public function isReference(): bool |
||||||
24 | { |
||||||
25 | return $this->isReference; |
||||||
26 | } |
||||||
27 | |||||||
28 | public function setIsReference(bool $isReference): void |
||||||
29 | { |
||||||
30 | $this->isReference = $isReference; |
||||||
31 | } |
||||||
32 | |||||||
33 | public function table($name): Table |
||||||
34 | { |
||||||
35 | if($this->isReference) { |
||||||
36 | $table = new Table($name, $this); |
||||||
37 | } else { |
||||||
38 | $table = $this->create('table', $name, $this); |
||||||
0 ignored issues
–
show
The method
create() does not exist on yentu\database\Schema . Since you implemented __call , consider adding a @method annotation.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
39 | } |
||||||
40 | $table->setIsReference($this->isReference); |
||||||
41 | return $table; |
||||||
42 | } |
||||||
43 | |||||||
44 | public function view($name) |
||||||
45 | { |
||||||
46 | return $this->create('view', $name, $this); |
||||||
47 | } |
||||||
48 | |||||||
49 | public function getName() |
||||||
50 | { |
||||||
51 | return $this->name; |
||||||
52 | } |
||||||
53 | |||||||
54 | #[\Override] |
||||||
55 | public function buildDescription() { |
||||||
56 | return array( |
||||||
57 | 'name' => $this->name |
||||||
58 | ); |
||||||
59 | } |
||||||
60 | } |
||||||
61 | |||||||
62 |