public function albumFormSubmitted(AppForm $form) { if ($form['save']->isSubmittedBy()) { $id = (int) $this->getParam('id'); $album = new Albums(); if ($id > 0) { $album->update($id, $form->getValues()); $this->flashMessage('The album has been updated.'); } else { $album->insert($form->getValues()); $this->flashMessage('The album has been added.'); } } $this->redirect('default'); }