Cake\Database\Query::delete PHP Метод

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.
    public function delete($table = null)
    {
        $this->_dirty();
        $this->_type = 'delete';
        if ($table !== null) {
            $this->from($table);
        }
        return $this;
    }

Usage Example

Пример #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));
 }
All Usage Examples Of Cake\Database\Query::delete