SQL : Suppression requêtes SELECT inutile avant UPDATE

Suppression requête SELECT avant UPDATE entry.is_favorite
pull/279/head
Alexandre Alapetite 11 years ago
parent 3f93866f38
commit 7e9263ff5c
  1. 25
      app/controllers/entryController.php

@ -72,25 +72,12 @@ class entryController extends ActionController {
$this->redirect = true; $this->redirect = true;
$id = Request::param ('id'); $id = Request::param ('id');
$is_fav = Request::param ('is_favorite'); if ($id) {
$entryDAO = new EntryDAO ();
if ($is_fav) { $values = array (
$is_fav = true; 'is_favorite' => (bool)($is_fav = Request::param ('is_favorite')),
} else { );
$is_fav = false; $entryDAO->updateEntry ($id, $values);
}
$entryDAO = new EntryDAO ();
if ($id != false) {
$entry = $entryDAO->searchById ($id);
if ($entry != false) {
$values = array (
'is_favorite' => $is_fav,
);
$entryDAO->updateEntry ($entry->id (), $values);
}
} }
} }

Loading…
Cancel
Save