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


PHP User::setPassword方法代码示例

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


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

示例1: user

 /**
  * @param string $username
  *
  * @return User
  */
 public function user($username, $withWorkspace = false)
 {
     $user = new User();
     $user->setFirstName($username);
     $user->setLastName($username);
     $user->setUsername($username);
     $user->setPassword($username);
     $user->setMail($username . '@mail.com');
     $user->setGuid($username);
     $this->om->persist($user);
     if (!$this->userRole) {
         $this->userRole = $this->role('ROLE_USER');
         $this->om->persist($this->userRole);
     }
     $user->addRole($this->userRole);
     if ($withWorkspace) {
         $workspace = new Workspace();
         $workspace->setName($username);
         $workspace->setCreator($user);
         $workspace->setCode($username);
         $workspace->setGuid($username);
         $this->om->persist($workspace);
         $user->setPersonalWorkspace($workspace);
     }
     return $user;
 }
开发者ID:claroline,项目名称:distribution,代码行数:31,代码来源:Persister.php

示例2: user

 public function user($username)
 {
     $user = new User();
     $user->setFirstName($username);
     $user->setLastName($username);
     $user->setUsername($username);
     $user->setPassword($username);
     $user->setMail($username . '@mail.com');
     $user->setGuid($username);
     $this->om->persist($user);
     if (!$this->userRole) {
         $this->userRole = new Role();
         $this->userRole->setName('ROLE_USER');
         $this->userRole->setTranslationKey('user');
         $this->om->persist($this->userRole);
     }
     $user->addRole($this->userRole);
     $workspace = new Workspace();
     $workspace->setName($username);
     $workspace->setCreator($user);
     $workspace->setCode($username);
     $workspace->setGuid($username);
     $this->om->persist($workspace);
     $user->setPersonalWorkspace($workspace);
     $this->om->flush();
     return $user;
 }
开发者ID:claroline,项目名称:distribution,代码行数:27,代码来源:Persister.php

示例3: buildUser

 private function buildUser($firstName, $lastName)
 {
     $user = new User();
     $user->setFirstName($firstName);
     $user->setLastName($lastName);
     $user->setUsername($username = strtolower($firstName . $lastName));
     $user->setPassword($username);
     $user->setMail("{$username}@mail.com");
     return $user;
 }
开发者ID:stefk,项目名称:CompetencyBundle,代码行数:10,代码来源:UserFixture.php

示例4: persistUser

 protected function persistUser($username)
 {
     $user = new User();
     $user->setFirstName($username);
     $user->setLastName($username);
     $user->setUsername($username);
     $user->setPassword($username);
     $user->setGuid($username);
     $user->setMail($username . '@mail.com');
     $this->om->persist($user);
     return $user;
 }
开发者ID:claroline,项目名称:distribution,代码行数:12,代码来源:RepositoryTestCase.php

示例5: user

 /**
  * @param string $username
  * @return User
  */
 public function user($username)
 {
     $roleUser = $this->om->getRepository('ClarolineCoreBundle:Role')->findOneByName('ROLE_USER');
     if (!$roleUser) {
         $this->role('ROLE_USER');
         $this->om->flush();
         //we really need it
     }
     $user = new User();
     $user->setFirstName($username);
     $user->setLastName($username);
     $user->setUsername($username);
     $user->setPassword($username);
     $user->setMail($username . '@mail.com');
     //much better
     $this->container->get('claroline.manager.user_manager')->createUser($user, false);
     return $user;
 }
开发者ID:ngydat,项目名称:CoreBundle,代码行数:22,代码来源:Persister.php

示例6: user

 /**
  * @param $username
  *
  * @return User
  */
 public function user($username)
 {
     $user = new User();
     $user->setFirstName($username);
     $user->setLastName($username);
     $user->setUsername($username);
     $user->setPassword($username);
     $user->setMail($username . '@mail.com');
     $user->setGuid($username);
     $this->om->persist($user);
     $user->addRole($this->userRole);
     $workspace = new Workspace();
     $workspace->setName($username);
     $workspace->setCreator($user);
     $workspace->setCode($username);
     $workspace->setGuid($username);
     $this->om->persist($workspace);
     $user->setPersonalWorkspace($workspace);
     return $user;
 }
开发者ID:claroline,项目名称:distribution,代码行数:25,代码来源:Persister.php

示例7: user

 public function user($username)
 {
     $user = new User();
     $user->setFirstName($username);
     $user->setLastName($username);
     $user->setUsername($username);
     $user->setPassword($username);
     $user->setMail($username . '@mail.com');
     $user->setGuid($username);
     $user->setPublicUrl($username);
     $this->om->persist($user);
     if (!$this->userRole) {
         $this->userRole = $this->om->getRepository('ClarolineCoreBundle:Role')->findOneByName('ROLE_USER');
     }
     $user->addRole($this->userRole);
     $workspace = new Workspace();
     $workspace->setName($username);
     $workspace->setCreator($user);
     $workspace->setCode($username);
     $workspace->setGuid($username);
     $this->om->persist($workspace);
     $user->setPersonalWorkspace($workspace);
     return $user;
 }
开发者ID:claroline,项目名称:distribution,代码行数:24,代码来源:Persister.php

示例8: createActivity

 private function createActivity($name)
 {
     $user = new User();
     $user->setFirstName('John');
     $user->setLastName('Doe');
     $user->setUsername('jdoe');
     $user->setMail('jd@mail.com');
     $user->setPassword('123');
     $workspace = new Workspace();
     $workspace->setName('w1');
     $workspace->setCode('abc');
     $workspace->setGuid('abc123');
     $workspace->setCreator($user);
     $type = new ResourceType();
     $type->setName('activity');
     $node = new ResourceNode();
     $node->setName($name);
     $node->setClass('FooClass');
     $node->setCreator($user);
     $node->setResourceType($type);
     $node->setWorkspace($workspace);
     $activity = new Activity();
     $activity->setResourceNode($node);
     $activity->setDescription('activity...');
     $this->om->persist($user);
     $this->om->persist($workspace);
     $this->om->persist($type);
     $this->om->persist($node);
     $this->om->persist($activity);
     return $activity;
 }
开发者ID:stefk,项目名称:CompetencyBundle,代码行数:31,代码来源:AbilityRepositoryTest.php


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