public function albumFormSucceeded($button) { $values = $button->getForm()->getValues(); $id = (int) $this->getParameter('id'); if ($id) { $this->albums->findById($id)->update($values); $this->flashMessage('The album has been updated.'); } else { $this->albums->insert($values); $this->flashMessage('The album has been added.'); } $this->redirect('default'); }