本文整理汇总了PHP中FOS\UserBundle\Model\User类的典型用法代码示例。如果您正苦于以下问题:PHP User类的具体用法?PHP User怎么用?PHP User使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了User类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isGranted
/**
* isGranted
*
* @param string $grantedRole
* @param User $user
* @return bool
*/
public function isGranted($grantedRole, User $user)
{
$grantedRole = new Role($grantedRole);
if (count($user->getRoles())) {
foreach ($user->getRoles() as $role) {
$roles = $this->roleHierarchy->getReachableRoles(array(new Role($role)));
if (in_array($grantedRole, $roles)) {
return true;
}
}
}
return false;
}
示例2: __construct
public function __construct()
{
parent::__construct();
$this->addRole('ROLE_USER');
$this->autoPassword = false;
$this->autoUsername = false;
}
示例3: setUsername
public function setUsername($username)
{
parent::setUsername($username);
// El email se configura automáticamente.
$this->setEmail($username . '@uco.es');
return $this;
}
示例4: __construct
/**
* User constructor.
*/
public function __construct()
{
parent::__construct();
$this->isActive = true;
// may not be needed, see section on salt below
// $this->salt = md5(uniqid(null, true));
}
示例5: setEmail
/**
* Set email
*
* @return string
*/
public function setEmail($email)
{
$email = is_null($email) ? '' : $email;
parent::setEmail($email);
$this->setUsername($email);
return $this;
}
示例6: __construct
public function __construct()
{
parent::__construct();
$this->requests = new ArrayCollection();
$this->experience = 0;
$this->newOauth = false;
}
示例7: __construct
public function __construct()
{
parent::__construct();
// your own logic
$this->commandes = new \Doctrine\Common\Collections\ArrayCollection();
$this->adresses = new \Doctrine\Common\Collections\ArrayCollection();
}
示例8: __construct
public function __construct()
{
parent::__construct();
// your own logic
$this->usuario_adopciones = new ArrayCollection();
$this->usuario_archivos = new ArrayCollection();
}
示例9: __construct
public function __construct()
{
parent::__construct();
$this->postsCreated = new ArrayCollection();
$this->tagsCreated = new ArrayCollection();
// your own logic
}
示例10: __construct
public function __construct()
{
parent::__construct();
$this->folders = new ArrayCollection();
$this->events = new ArrayCollection();
$this->enabled = 0;
}
示例11: __construct
public function __construct($class)
{
parent::__construct($class);
//$now = new \Datetime();
//$this->created = $now;
//$this->updated = $now;
}
示例12: __construct
public function __construct()
{
parent::__construct();
$this->address = new \Doctrine\Common\Collections\ArrayCollection();
$this->orders = new \Doctrine\Common\Collections\ArrayCollection();
$this->userImg = new \Doctrine\Common\Collections\ArrayCollection();
}
示例13: __construct
public function __construct()
{
parent::__construct();
$this->forumQuestions = new ArrayCollection();
$this->forumAnswers = new ArrayCollection();
$this->lots = new ArrayCollection();
}
示例14: __construct
public function __construct()
{
parent::__construct();
$this->files = new ArrayCollection();
$this->directories = new ArrayCollection();
$this->playlists = new ArrayCollection();
}
示例15: __construct
public function __construct()
{
$this->artigos = new ArrayCollection();
$this->mensagens = new ArrayCollection();
$this->topicos = new ArrayCollection();
parent::__construct();
}