PrimaryKey::dropKey()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 4
rs 10
1
<?php
2
3
namespace yentu\database;
4
5
use yentu\exceptions\SyntaxErrorException;
6
7
class PrimaryKey extends BasicKey
8
{
9
    #[\Override]
10
    protected function addKey($constraint)
11
    {
12
        $this->getChangeLogger()->addPrimaryKey($constraint);
0 ignored issues
show
Bug introduced by
The method addPrimaryKey() 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 ignore-call  annotation

12
        $this->getChangeLogger()->/** @scrutinizer ignore-call */ addPrimaryKey($constraint);
Loading history...
13
    }
14
15
    #[\Override]
16
    protected function doesKeyExist($constraint)
17
    {
18
        return $this->getChangeLogger()->doesPrimaryKeyExist($constraint);
0 ignored issues
show
Bug introduced by
The method doesPrimaryKeyExist() 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 ignore-call  annotation

18
        return $this->getChangeLogger()->/** @scrutinizer ignore-call */ doesPrimaryKeyExist($constraint);
Loading history...
19
    }
20
21
    #[\Override]
22
    protected function dropKey($constraint)
23
    {
24
        $this->getChangeLogger()->dropPrimaryKey($constraint);
0 ignored issues
show
Bug introduced by
The method dropPrimaryKey() 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 ignore-call  annotation

24
        $this->getChangeLogger()->/** @scrutinizer ignore-call */ dropPrimaryKey($constraint);
Loading history...
25
    }
26
27
    #[\Override]
28
    protected function getNamePostfix()
29
    {
30
        return 'pk';
31
    }
32
33
    public function autoIncrement()
34
    {
35
        if (count($this->columns) > 1) {
36
            throw new SyntaxErrorException("Cannot make an auto incrementing composite key.", $this->home);
37
        }
38
39
        $this->getChangeLogger()->addAutoPrimaryKey(
0 ignored issues
show
Bug introduced by
The method addAutoPrimaryKey() 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 ignore-call  annotation

39
        $this->getChangeLogger()->/** @scrutinizer ignore-call */ addAutoPrimaryKey(
Loading history...
40
            \yentu\Parameters::wrap(array(
41
                    'table' => $this->table->getName(),
42
                    'schema' => $this->table->getSchema()->getName(),
43
                    'column' => $this->columns[0]
44
                )
45
            )
46
        );
47
        return $this;
48
    }
49
}
50