1 | <?php |
||
20 | class Update extends AbstractDmlQuery implements UpdateInterface |
||
21 | { |
||
22 | use WhereTrait; |
||
23 | |||
24 | /** |
||
25 | * |
||
26 | * The table to update. |
||
27 | * |
||
28 | * @var string |
||
29 | * |
||
30 | */ |
||
31 | protected $table; |
||
32 | |||
33 | /** |
||
34 | * |
||
35 | * Sets the table to update. |
||
36 | * |
||
37 | * @param string $table The table to update. |
||
38 | * |
||
39 | * @return $this |
||
40 | * |
||
41 | */ |
||
42 | 23 | public function table($table) |
|
47 | |||
48 | /** |
||
49 | * |
||
50 | * Builds this query object into a string. |
||
51 | * |
||
52 | * @return string |
||
53 | * |
||
54 | */ |
||
55 | 16 | protected function build() |
|
64 | |||
65 | /** |
||
66 | * |
||
67 | * Sets one column value placeholder; if an optional second parameter is |
||
68 | * passed, that value is bound to the placeholder. |
||
69 | * |
||
70 | * @param string $col The column name. |
||
71 | * |
||
72 | * @param array $value |
||
73 | * |
||
74 | * @return $this |
||
75 | */ |
||
76 | 6 | public function col($col, ...$value) |
|
80 | |||
81 | /** |
||
82 | * |
||
83 | * Sets multiple column value placeholders. If an element is a key-value |
||
84 | * pair, the key is treated as the column name and the value is bound to |
||
85 | * that column. |
||
86 | * |
||
87 | * @param array $cols A list of column names, optionally as key-value |
||
88 | * pairs where the key is a column name and the value is a bind value for |
||
89 | * that column. |
||
90 | * |
||
91 | * @return $this |
||
92 | * |
||
93 | */ |
||
94 | 20 | public function cols(array $cols) |
|
98 | |||
99 | /** |
||
100 | * |
||
101 | * Sets a column value directly; the value will not be escaped, although |
||
102 | * fully-qualified identifiers in the value will be quoted. |
||
103 | * |
||
104 | * @param string $col The column name. |
||
105 | * |
||
106 | * @param string $value The column value expression. |
||
107 | * |
||
108 | * @return $this |
||
109 | * |
||
110 | */ |
||
111 | 14 | public function set($col, $value) |
|
115 | } |
||
116 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: