Пример #1
0
 /**
  * @param array $attributes
  * @param bool  $clearErrors
  *
  * @throws DreamFactory\Platform\Exceptions\ForbiddenException
  * @return bool
  */
 public function validate($attributes = null, $clearErrors = true)
 {
     if ($this->_skipped) {
         $this->_emailAddress = null;
         return true;
     }
     /** @var User $_user */
     if (null === ($_user = User::model()->findByPk(Session::getCurrentUserId()))) {
         throw new ForbiddenException();
     }
     if (empty($this->_emailAddress)) {
         $this->_emailAddress = $_user->email;
     }
     return parent::validate($attributes, $clearErrors);
 }