/**
  * Executes an SQL DELETE statement on a table.
  *
  * Table expression and columns are not escaped and are not safe for user-input.
  *
  * @param string $tableExpression  The expression of the table on which to delete.
  * @param array  $identifier The deletion criteria. An associative array containing column-value pairs.
  * @param array  $types      The types of identifiers.
  *
  * @return integer The number of affected rows.
  *
  * @throws InvalidArgumentException
  */
 public function delete($tableExpression, array $identifier, array $types = array())
 {
     if (empty($identifier)) {
         throw InvalidArgumentException::fromEmptyCriteria();
     }
     $this->connect();
     $criteria = array();
     foreach (array_keys($identifier) as $columnName) {
         $criteria[] = $columnName . ' = ?';
     }
     return $this->executeUpdate('DELETE FROM ' . $tableExpression . ' WHERE ' . implode(' AND ', $criteria), array_values($identifier), is_string(key($types)) ? $this->extractTypeValues($identifier, $types) : $types);
 }
 public function testFromEmptyCriteria()
 {
     $exception = InvalidArgumentException::fromEmptyCriteria();
     $this->assertInstanceOf('Doctrine\\DBAL\\Exception\\InvalidArgumentException', $exception);
     $this->assertSame('Empty criteria was used, expected non-empty criteria', $exception->getMessage());
 }