| @@ 129-139 (lines=11) @@ | ||
| 126 | * |
|
| 127 | * @return this |
|
| 128 | */ |
|
| 129 | public function findWhere($where, $value) |
|
| 130 | { |
|
| 131 | $this->checkDb(); |
|
| 132 | $params = is_array($value) ? $value : [$value]; |
|
| 133 | return $this->db->connect() |
|
| 134 | ->select() |
|
| 135 | ->from($this->tableName) |
|
| 136 | ->where($where) |
|
| 137 | ->execute($params) |
|
| 138 | ->fetchInto($this); |
|
| 139 | } |
|
| 140 | ||
| 141 | ||
| 142 | ||
| @@ 174-184 (lines=11) @@ | ||
| 171 | * |
|
| 172 | * @return array of object of this class |
|
| 173 | */ |
|
| 174 | public function findAllWhere($where, $value) |
|
| 175 | { |
|
| 176 | $this->checkDb(); |
|
| 177 | $params = is_array($value) ? $value : [$value]; |
|
| 178 | return $this->db->connect() |
|
| 179 | ->select() |
|
| 180 | ->from($this->tableName) |
|
| 181 | ->where($where) |
|
| 182 | ->execute($params) |
|
| 183 | ->fetchAllClass(get_class($this)); |
|
| 184 | } |
|
| 185 | ||
| 186 | ||
| 187 | ||
| @@ 344-353 (lines=10) @@ | ||
| 341 | * |
|
| 342 | * @return void |
|
| 343 | */ |
|
| 344 | public function deleteWhere($where, $value) |
|
| 345 | { |
|
| 346 | $this->checkDb(); |
|
| 347 | $values = is_array($value) ? $value : [$value]; |
|
| 348 | ||
| 349 | $this->db->connect() |
|
| 350 | ->deleteFrom($this->tableName) |
|
| 351 | ->where($where) |
|
| 352 | ->execute($values); |
|
| 353 | } |
|
| 354 | } |
|
| 355 | ||