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