original_string: public function activate()
      {
          if ($this->status == self::STATUS_REGISTERED) {
              $transaction = static::getDb()->beginTransaction();
              try {
                  $this->removeActivationToken();
                  $this->status = self::STATUS_ACTIVE;
                  if (!$this->save()) {
                      throw new Exception('User saving error!');
                  }
                  if (!Podium::getInstance()->rbac->assign(Podium::getInstance()->rbac->getRole(Rbac::ROLE_USER), $this->id)) {
                      throw new Exception('User role assigning error!');
                  }
                  $transaction->commit();
                  return true;
              } catch (Exception $e) {
                  $transaction->rollBack();
                  Log::error($e->getMessage(), null, __METHOD__);
              }
          }
          return false;
      }
code: public function activate()
      {
          if ($this->status == self::STATUS_REGISTERED) {
              $transaction = static::getDb()->beginTransaction();
              try {
                  $this->removeActivationToken();
                  $this->status = self::STATUS_ACTIVE;
                  if (!$this->save()) {
                      throw new Exception('User saving error!');
                  }
                  if (!Podium::getInstance()->rbac->assign(Podium::getInstance()->rbac->getRole(Rbac::ROLE_USER), $this->id)) {
                      throw new Exception('User role assigning error!');
                  }
                  $transaction->commit();
                  return true;
              } catch (Exception $e) {
                  $transaction->rollBack();
                  Log::error($e->getMessage(), null, __METHOD__);
              }
          }
          return false;
      }
code_tokens: public function activate ( ) { if ( $ this -> status == self :: STATUS_REGISTERED ) { $ transaction = static :: getDb ( ) -> beginTransaction ( ) ; try { $ this -> removeActivationToken ( ) ; $ this -> status = self :: STATUS_ACTIVE ; if ( ! $ this -> save ( ) ) { throw new Exception ( 'User saving error!' ) ; } if ( ! Podium :: getInstance ( ) -> rbac -> assign ( Podium :: getInstance ( ) -> rbac -> getRole ( Rbac :: ROLE_USER ) , $ this -> id ) ) { throw new Exception ( 'User role assigning error!' ) ; } $ transaction -> commit ( ) ; return true ; } catch ( Exception $ e ) { $ transaction -> rollBack ( ) ; Log :: error ( $ e -> getMessage ( ) , null , __METHOD__ ) ; } } return false ; }
docstring: Activates account.
  @return bool
docstring_tokens: Activates account .