public function processForm(Form $form) { $this->requireLogin(); $values = $form->getValues(); $id = $values->id; unset($values->id); if ($id) { // edit project $this->checkPermission($id); $this->project->edit($id, $values); } else { // add project $values->author = $this->user->id; $data = $this->project->add($values); $id = $data->id; } $this->redirect('Project:show', ['id' => $id]); }