public function executeEditchapter() { $c = new Criteria(); $c->add(ChapterPeer::NAME, $this->getRequestParameter('chapter')); $exchapter = ChapterPeer::doSelectOne($c); if ($exchapter) { $this->setFlash('notice', 'Chapter could not be added. A chapter with this name already exists.'); } else { $chaptername = $this->getRequestParameter('chapter'); $regionid = $this->getRequestParameter('region'); $chapter = ChapterPeer::retrieveByPK($this->getRequestParameter('id')); $chapter->setName($chaptername); $chapter->save(); $cr = $chapter->getChapterregion(); $cr->setRegionId($regionid); $cr->save(); $this->setFlash('notice', 'Chapter Edited Successfully'); } $this->redirect('admin/chapters'); }