diff options
| author | 2013-11-12 18:51:02 +0100 | |
|---|---|---|
| committer | 2013-11-12 18:51:02 +0100 | |
| commit | 7e9263ff5c0f0f0593deb386aacf4043b43e70e2 (patch) | |
| tree | 3ceeb52c571b6e32fb1f0d023438ece86b3f48ac /app/controllers/entryController.php | |
| parent | 3f93866f38aff6b9f10d57472bf0ccf16d268499 (diff) | |
SQL : Suppression requêtes SELECT inutile avant UPDATE
Suppression requête SELECT avant UPDATE entry.is_favorite
Diffstat (limited to 'app/controllers/entryController.php')
| -rwxr-xr-x | app/controllers/entryController.php | 25 |
1 files changed, 6 insertions, 19 deletions
diff --git a/app/controllers/entryController.php b/app/controllers/entryController.php index 4c9eb9d1b..7ac9c4c0b 100755 --- a/app/controllers/entryController.php +++ b/app/controllers/entryController.php @@ -72,25 +72,12 @@ class entryController extends ActionController { $this->redirect = true; $id = Request::param ('id'); - $is_fav = Request::param ('is_favorite'); - - if ($is_fav) { - $is_fav = true; - } else { - $is_fav = false; - } - - $entryDAO = new EntryDAO (); - if ($id != false) { - $entry = $entryDAO->searchById ($id); - - if ($entry != false) { - $values = array ( - 'is_favorite' => $is_fav, - ); - - $entryDAO->updateEntry ($entry->id (), $values); - } + if ($id) { + $entryDAO = new EntryDAO (); + $values = array ( + 'is_favorite' => (bool)($is_fav = Request::param ('is_favorite')), + ); + $entryDAO->updateEntry ($id, $values); } } |
