예제 #1
0
파일: User.class.php 프로젝트: rgevaert/uas
 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();
 }