Total Complexity | 5 |
Total Lines | 43 |
Duplicated Lines | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
5 | class Update extends Base |
||
6 | { |
||
7 | protected function mountQuery(): void |
||
8 | { |
||
9 | |||
10 | $dateSet = []; |
||
11 | foreach ($this->fields as $bind => $value) { |
||
12 | $dateSet[] = "{$bind} = ?"; |
||
13 | } |
||
14 | $dateSet = implode(", ", $dateSet); |
||
15 | |||
16 | $this->query = "UPDATE {$this->entity} {$this->joins} SET {$dateSet} {$this->where}"; |
||
17 | } |
||
18 | |||
19 | /** |
||
20 | * @param array $data |
||
21 | */ |
||
22 | public function update(array $data): static |
||
23 | { |
||
24 | $this->setBindings(array_values($data), 'update'); |
||
25 | |||
26 | $this->fields = $data; |
||
27 | |||
28 | return $this; |
||
29 | } |
||
30 | |||
31 | /** |
||
32 | * @param array $data |
||
33 | */ |
||
34 | public function exec(): ?int |
||
48 | } |
||
49 | } |
||
50 | } |
||
51 |