Exemple #1
0
 /**
  * En base a una tabla y un objeto elimina el mismo de la base de datos
  * @param type $table
  * @param \Enola\DB\Storable $object
  * @return boolean
  * @throws \PDOException
  */
 public function deleteObject($table, Storable $object)
 {
     try {
         //Armo el Where
         $where = '';
         foreach ($object->keys() as $key => $value) {
             if ($where != '') {
                 $where = 'AND ';
             }
             $where .= $key . '=:' . $key . ' ';
         }
         //Armo y preparo la consulta
         $query = $this->prepareDelete($table, $where);
         //Ejecuto la consulta
         $query->execute($object->keys());
         $error = $query->errorInfo();
         if ($error[0] != '00000') {
             $this->catchError($error);
             return FALSE;
         } else {
             return TRUE;
         }
     } catch (\PDOException $e) {
         throw $e;
     }
 }