/** * @param Form $form */ public function formSucceeded(Form $form) { $values = $form->getValues(); /** @var GalleriesEntity $galleries */ $galleries = $this->galleriesRepository->get($values->id); $galleries->name($values->name); $galleries->description($values->description); $galleries->url(Strings::webalize($values->name)); $this->galleriesRepository->save($galleries); }
/** * @param int $id */ public function renderEdit($id = 0) { /** @var Form $form */ $form = $this['editForm']; $this->getTemplate()->id = $id; if (!$form->isSubmitted()) { $item = $this->galleriesRepository->get($id); $row = $this->galleriesRepository->itemToArray($item); if (!$row) { throw new PDOException('Záznam nenalezen'); } $form->setDefaults($row); } }