52 lines
901 B
PHP
52 lines
901 B
PHP
<?php
|
|
|
|
namespace Catalyst\AuthBundle\Entity;
|
|
|
|
abstract class User
|
|
{
|
|
protected $roles;
|
|
protected $enabled;
|
|
|
|
public function __construct()
|
|
{
|
|
$this->roles = new ArrayCollection();
|
|
$this->enabled = true;
|
|
}
|
|
|
|
public function getRoles()
|
|
{
|
|
$str_roles = [];
|
|
foreach ($this->roles as $role)
|
|
$str_roles[] = $role->getID();
|
|
|
|
return $str_roles;
|
|
}
|
|
|
|
public function getRoleObjects()
|
|
{
|
|
return $this->roles;
|
|
}
|
|
|
|
public function addRole(Role $role)
|
|
{
|
|
$this->roles->add($role);
|
|
return $this;
|
|
}
|
|
|
|
public function clearRoles()
|
|
{
|
|
$this->roles->clear();
|
|
return $this;
|
|
}
|
|
|
|
public function setEnabled($enabled = true)
|
|
{
|
|
$this->enabled = $enabled;
|
|
return $this;
|
|
}
|
|
|
|
public function isEnabled()
|
|
{
|
|
return $this->enabled;
|
|
}
|
|
}
|