/** * @param $id * @param $performanceId * @param $childId */ public function handleDeleteChild($id, $performanceId, $childId) { if ($id and $childId and $performanceId and $child = $this->childFacade->findChildById($childId)) { $this->childFacade->delete($child); } $this->flashMessage("Žák byl odebrán", "success"); $this->redirect("this"); }
/** * @param \Nette\Application\UI\Form $form */ public function processForm(Form $form) { $values = $form->values; $teacher = $values->teacher ? $this->userFacade->findUserById($values->teacher) : null; if ($this->child) { $child = $this->child; $child->teacher = $teacher; } else { $child = new Entity\Child($this->performance, $teacher); } $child->name = $values->name; $child->instrument = $values->instrument; $child->class = $values->class; $this->childFacade->save($child); }