1 | <?php |
||||
2 | |||||
3 | /** |
||||
4 | * This file is part of Cycle ORM package. |
||||
5 | * |
||||
6 | * For the full copyright and license information, please view the LICENSE |
||||
7 | * file that was distributed with this source code. |
||||
8 | */ |
||||
9 | |||||
10 | declare(strict_types=1); |
||||
11 | |||||
12 | namespace Cycle\Database\Query; |
||||
13 | |||||
14 | use Cycle\Database\Driver\CompilerInterface; |
||||
15 | use Cycle\Database\Query\Traits\TokenTrait; |
||||
16 | use Cycle\Database\Query\Traits\WhereJsonTrait; |
||||
17 | use Cycle\Database\Query\Traits\WhereTrait; |
||||
18 | |||||
19 | /** |
||||
20 | * Update statement builder. |
||||
21 | */ |
||||
22 | class DeleteQuery extends ActiveQuery |
||||
23 | { |
||||
24 | use TokenTrait; |
||||
25 | use WhereJsonTrait; |
||||
26 | use WhereTrait; |
||||
27 | |||||
28 | protected string $table = ''; |
||||
29 | |||||
30 | /** |
||||
31 | * @param non-empty-string|null $table Associated table name. |
||||
0 ignored issues
–
show
Documentation
Bug
introduced
by
![]() |
|||||
32 | 78 | * @param array $where Initial set of where rules specified as array. |
|||
33 | */ |
||||
34 | 78 | public function __construct(?string $table = null, array $where = []) |
|||
35 | { |
||||
36 | 78 | $this->table = $table ?? ''; |
|||
37 | |||||
38 | if ($where !== []) { |
||||
39 | 78 | $this->where($where); |
|||
40 | } |
||||
41 | } |
||||
42 | |||||
43 | /** |
||||
44 | * Change target table. |
||||
45 | * |
||||
46 | 74 | * @psalm-param non-empty-string $into Table name without prefix. |
|||
47 | */ |
||||
48 | 74 | public function from(string $into): self |
|||
49 | { |
||||
50 | 74 | $this->table = $into; |
|||
51 | |||||
52 | return $this; |
||||
53 | } |
||||
54 | |||||
55 | /** |
||||
56 | 24 | * Alias for execute method(); |
|||
57 | */ |
||||
58 | 24 | public function run(): int |
|||
59 | 24 | { |
|||
60 | $params = new QueryParameters(); |
||||
61 | 24 | $queryString = $this->sqlStatement($params); |
|||
62 | |||||
63 | return $this->driver->execute($queryString, $params->getParameters()); |
||||
0 ignored issues
–
show
The method
execute() does not exist on null .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. ![]() |
|||||
64 | 58 | } |
|||
65 | |||||
66 | 58 | public function getType(): int |
|||
67 | { |
||||
68 | return CompilerInterface::DELETE_QUERY; |
||||
69 | 58 | } |
|||
70 | |||||
71 | public function getTokens(): array |
||||
72 | 58 | { |
|||
73 | 58 | return [ |
|||
74 | 'table' => $this->table, |
||||
75 | 'where' => $this->whereTokens, |
||||
76 | ]; |
||||
77 | } |
||||
78 | } |
||||
79 |