Exemplo n.º 1
0
 public function deleteAllById(array $ids)
 {
     if (!count($ids)) {
         return false;
     }
     $ids = array_values($ids);
     $result = false;
     $prep = '';
     $bind = [];
     try {
         for ($i = 0; $i < count($ids); $i++) {
             if (!empty($prep)) {
                 $prep .= " OR ";
             }
             $prep .= "uid = :uid{$i}";
             $bind[":uid{$i}"] = $ids[$i];
         }
         $result = $this->connect->delete($this->tableName, $prep, $bind);
         if ($result) {
             $result = $result->rowCount();
         }
     } catch (\AbstractDriverException $error) {
     }
     return $result;
 }
Exemplo n.º 2
0
 /**
  * @param $id
  * @return \Doctrine\DBAL\Driver\Statement|int
  */
 public function deleteById($id)
 {
     $result = $this->connect->delete($this->tableName, 'id = :id', [':id' => $id]);
     return $result ? $result->rowCount() : $result;
 }