Exemplo n.º 1
0
 /**
  * Delete the records matching the conditions and limits of the query.
  *
  * @param string $tables When using a JOIN, `$tables` is used to specify the tables in which
  * records should be deleted. Default: The alias of queried model, only if at least one join
  * clause has been defined using the {@link join()} method.
  *
  * @return bool The result of the operation.
  *
  * @todo-20140901: reflect on join to add the required tables by default, discarding tables
  * joined with the LEFT mode.
  */
 public function delete($tables = null)
 {
     if (!$tables && $this->joints) {
         $tables = "`{alias}`";
     }
     if ($tables) {
         $query = "DELETE {$tables} FROM {self} AS `{alias}`";
     } else {
         $query = "DELETE FROM {self}";
     }
     $query .= $this->render_main();
     return $this->model->execute($query, $this->args);
 }