示例#1
0
 public function validateAdd()
 {
     if ($this->isPOST()) {
         $c = new Criteria();
         $c->add(DomainPeer::NAME, $this->getRequestParameter('name'));
         if (DomainPeer::doSelectOne($c)) {
             $this->getRequest()->setError('name', 'This name is already in use.');
             return false;
         }
         if (!($this->template = TemplatePeer::retrieveByPK($this->getRequestParameter('template_id')))) {
             $this->getRequest()->setError('template_id', 'Invalid template id.');
             return false;
         }
     }
     return true;
 }