本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}