delete() публичный метод

Can be combined with from(), where() and other methods to create delete queries with specific conditions.
public delete ( string | null $table = null )
$table string | null The table to use when deleting.
Пример #1
0
 /**
  * Test that epilog() will actually append a string to a delete query
  *
  * @return void
  */
 public function testAppendDelete()
 {
     $query = new Query($this->connection);
     $sql = $query->delete('articles')->where(['id' => 1])->epilog('RETURNING id')->sql();
     $this->assertContains('DELETE FROM', $sql);
     $this->assertContains('WHERE', $sql);
     $this->assertEquals(' RETURNING id', substr($sql, -13));
 }
 /**
  * Create a delete query.
  *
  * This changes the query type to be 'delete'.
  * Can be combined with the where() method to create delete queries.
  *
  * @param string|null $table Unused parameter.
  * @return $this
  */
 public function delete($table = null)
 {
     $repo = $this->repository();
     $this->from([$repo->alias() => $repo->table()]);
     return parent::delete();
 }
Пример #3
0
 /**
  * Create a delete query.
  *
  * This changes the query type to be 'delete'.
  * Can be combined with the where() method to create delete queries.
  *
  * @param string $table Unused parameter.
  * @return Query
  */
 public function delete($table = null)
 {
     $table = $this->repository()->table();
     return parent::delete($table);
 }