1
|
|
|
<?php |
2
|
|
|
namespace Kir\MySQL\Builder; |
3
|
|
|
|
4
|
|
|
use Kir\MySQL\Builder\Internal\Types; |
5
|
|
|
use Kir\MySQL\Builder\Traits\JoinBuilder; |
6
|
|
|
use Kir\MySQL\Builder\Traits\LimitBuilder; |
7
|
|
|
use Kir\MySQL\Builder\Traits\OffsetBuilder; |
8
|
|
|
use Kir\MySQL\Builder\Traits\OrderByBuilder; |
9
|
|
|
use Kir\MySQL\Builder\Traits\TableBuilder; |
10
|
|
|
use Kir\MySQL\Builder\Traits\TableNameBuilder; |
11
|
|
|
use Kir\MySQL\Builder\Traits\WhereBuilder; |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* @phpstan-import-type DBTableNameType from Types |
15
|
|
|
*/ |
16
|
|
|
abstract class Delete extends Statement { |
17
|
|
|
use TableNameBuilder; |
18
|
|
|
use TableBuilder; |
19
|
|
|
use JoinBuilder; |
20
|
|
|
use WhereBuilder; |
21
|
|
|
use OrderByBuilder; |
22
|
|
|
use LimitBuilder; |
23
|
|
|
use OffsetBuilder; |
24
|
|
|
|
25
|
|
|
/** @var string[] */ |
26
|
|
|
private array $aliases = []; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* Name der Tabelle |
30
|
|
|
* |
31
|
|
|
* @param ($table is null ? DBTableNameType : string) $alias |
|
|
|
|
32
|
|
|
* @param null|DBTableNameType $table |
|
|
|
|
33
|
|
|
* @return $this |
34
|
|
|
*/ |
35
|
|
|
public function from($alias, $table = null) { |
36
|
|
|
if($table !== null) { |
37
|
|
|
$this->aliases[] = $alias; |
38
|
|
|
} |
39
|
|
|
if($table === null) { |
40
|
|
|
[$alias, $table] = [$table, $alias]; |
41
|
|
|
} |
42
|
|
|
$this->addTable($alias, $table); |
43
|
|
|
return $this; |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* @param array<string, mixed> $params |
48
|
|
|
* @return int |
49
|
|
|
*/ |
50
|
|
|
abstract public function run(array $params = []); |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* @return string |
54
|
|
|
*/ |
55
|
|
|
public function __toString(): string { |
56
|
|
|
$query = 'DELETE '; |
57
|
|
|
$query .= implode(', ', $this->aliases); |
58
|
|
|
$query = trim($query) . " FROM\n"; |
59
|
|
|
$query = $this->buildTables($query); |
60
|
|
|
$query = $this->buildJoins($query); |
61
|
|
|
$query = $this->buildWhereConditions($query); |
62
|
|
|
$query = $this->buildOrder($query); |
63
|
|
|
$query = $this->buildLimit($query); |
64
|
|
|
$query = $this->buildOffset($query); |
65
|
|
|
return $query; |
66
|
|
|
} |
67
|
|
|
} |
68
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths