Exemplo n.º 1
0
 public function save(Doctrine_Connection $con = null)
 {
     // a new record?
     if (!$this->getId()) {
         $this->setUid(UserTable::getMaxUid() + 1);
     }
     if (!$this->getDomainnameId()) {
         // get the default domainname
         $domainname = DomainnameTable::getDefaultDomainname();
         $this->setDomainnameId($domainname->getId());
     }
     if (!$this->getLogin()) {
         $this->generateLogin();
     }
     if (!$this->getEmailLocalPart()) {
         $this->generateEmailLocalPart();
     }
     if (!$this->getCryptPassword()) {
         $password = new Password();
         $this->setPasswordObject($password);
         $this->generated_password = $password->getPassword();
     }
     // linking a one-on-one sfGuardUser
     $sfguard_user = $this->getSfGuardUser();
     $sfguard_user->setUsername($this->getLogin());
     $sfguard_user->setIsActive(true);
     $sfguard_user->save();
     $this->setSfguarduserId($sfguard_user->getId());
     return parent::save();
 }