当前位置: 首页>>代码示例>>PHP>>正文


PHP Profile::setUser方法代码示例

本文整理汇总了PHP中Profile::setUser方法的典型用法代码示例。如果您正苦于以下问题:PHP Profile::setUser方法的具体用法?PHP Profile::setUser怎么用?PHP Profile::setUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Profile的用法示例。


在下文中一共展示了Profile::setUser方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: registerUser

 private function registerUser($username, $data = NULL)
 {
     try {
         $gingerKey = sfConfig::get('app_portail_ginger_key');
         if ($gingerKey != "abc") {
             $ginger = new \Ginger\Client\GingerClient(sfConfig::get('app_portail_ginger_key'));
             $cotisants = $ginger->getUser($username);
         } else {
             $cotisants = new stdClass();
             $cotisants->mail = $username . "@etu.utc.fr";
             $cotisants->prenom = "Le";
             $cotisants->nom = "Testeur";
             $cotisants->type = "etu";
         }
         if (!$data) {
             $data = new sfGuardUser();
         }
         $data->setUsername($username);
         $data->setEmailAddress($cotisants->mail);
         $data->setFirstName($cotisants->prenom);
         $data->setLastName($cotisants->nom);
         $data->setIsActive(true);
         $data->save();
         $profile = new Profile();
         $profile->setUser($data);
         $profile->setDomain($cotisants->type);
         $profile->save();
         return $data;
     } catch (\Ginger\Client\ApiException $ex) {
         $this->setFlash('error', "Il n'a pas été possible de vous identifier. Merci de contacter simde@assos.utc.fr en précisant votre login et le code d'erreur " . $ex->getCode() . ".");
     }
     return false;
 }
开发者ID:TheoJD,项目名称:portail,代码行数:33,代码来源:sfUTCCASUser.class.php

示例2: getProfile

 public function getProfile()
 {
     if (!$this->securityContext->isGranted('IS_AUTHENTICATED_REMEMBERED')) {
         throw new \LogicException("Can't get profile of a non-authenticated user.");
     }
     $user = $this->securityContext->getToken()->getUser();
     $repo = $this->em->getRepository('ZzPyroBundle:Profile');
     $profile = $repo->findOneByUser($user);
     if ($profile === null) {
         $profile = new Profile();
         $profile->setUser($user);
         $this->em->persist($profile);
     }
     return $profile;
 }
开发者ID:Zzortell,项目名称:Pyro,代码行数:15,代码来源:ProfileManager.php

示例3: anyCreate

 /**
  * Create
  */
 public function anyCreate()
 {
     $user = new User();
     $profile = new Profile();
     // process POST
     if ($_POST) {
         // check for valid data
         // typecast to prevent error (if there are no profile fields)
         $userValidate = $user->fillValidateAdminCreate(Input::get("User"));
         $profileValidate = $profile->fillValidateAdminCreate((array) Input::get("Profile"));
         if ($userValidate and $profileValidate) {
             $user->save();
             $profile->setUser($user->id)->save();
             // set success and reload page
             Session::flash("success", $user);
             return Redirect::to(Request::path());
         }
     }
     return View::make("admin.create", array("user" => $user, "profile" => $profile));
 }
开发者ID:amnah,项目名称:laravel-user,代码行数:23,代码来源:AdminController.php

示例4: _register

 /**
  * Register new user
  * @param User $user
  * @param Profile $profile
  * @return bool
  */
 protected function _register($user, $profile)
 {
     // set up user and profile
     $roleId = Role::USER;
     $status = User::STATUS_ACTIVE;
     if (Config::get("auth.emailActivation")) {
         $status = User::STATUS_INACTIVE;
         $user->generateToken();
     }
     $user->setDefaults($roleId, $status)->save();
     $profile->setUser($user->id)->save();
     // generate activation key and send email
     if (Config::get("auth.emailActivation")) {
         // send email
         $data["user"] = $user;
         $count = Mail::send(Config::get("auth.emailViewPath") . ".activate", $data, function ($message) use($user, $profile) {
             $message->to($user->email, $user->username)->subject("Activate your new account");
         });
     } else {
         Auth::login($user);
     }
 }
开发者ID:amnah,项目名称:laravel-user,代码行数:28,代码来源:UserController.php

示例5: getUser

 function getUser()
 {
     if (is_null($this->UserID)) {
         return parent::getUser();
     }
     if (is_null(parent::getUser()) && $this->UserID) {
         parent::setUser(Outlet::getInstance()->load('User', $this->UserID));
     }
     return parent::getUser();
 }
开发者ID:jimmydivvy,项目名称:outlet-orm,代码行数:10,代码来源:outlet-proxies.php


注:本文中的Profile::setUser方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。