public function validateEdit() { if ($this->isPOST()) { if (!($this->template = TemplatePeer::retrieveByPK($this->getRequestParameter('id')))) { $this->getRequest()->setError('id', 'Invalid template id.'); return false; } $c = new Criteria(); $c->add(TemplatePeer::ID, $this->getRequestParameter('id'), Criteria::NOT_EQUAL); $c->add(TemplatePeer::NAME, $this->getRequestParameter('name')); if (TemplatePeer::doSelectOne($c)) { $this->getRequest()->setError('name', 'Name already in use.'); return false; } return $this->commonValidate(); } return true; }