Total Complexity | 4 |
Total Lines | 40 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
6 | class Create extends Base |
||
7 | { |
||
8 | protected function mountQuery(): void |
||
9 | { |
||
10 | $columns = implode(", ", array_keys($this->fields)); |
||
11 | $values = implode(',', array_fill(0, count($this->fields), '?')); |
||
12 | |||
13 | $this->query = "INSERT INTO {$this->entity} ({$columns}) VALUES ({$values})"; |
||
14 | } |
||
15 | |||
16 | /** |
||
17 | * @param array $data |
||
18 | * @return Create |
||
19 | */ |
||
20 | public function create(array $data): static |
||
21 | { |
||
22 | $this->setBindings(array_values($data), 'create'); |
||
23 | |||
24 | $this->fields = $data; |
||
25 | |||
26 | return $this; |
||
27 | } |
||
28 | |||
29 | /** |
||
30 | * @param array $data |
||
31 | */ |
||
32 | public function exec(): ?int |
||
46 | } |
||
47 | } |
||
48 | } |
||
49 |