infinito/application/src/Entity/User.php

90 lines
1.9 KiB
PHP
Raw Normal View History

2018-09-05 15:46:14 +02:00
<?php
namespace App\Entity;
2018-09-06 11:57:32 +02:00
use Symfony\Component\Security\Core\User\UserInterface;
2018-09-05 15:46:14 +02:00
/**
*
* @author kevinfrantz
2018-09-06 11:57:32 +02:00
* @ORM\Table(name="source_user")
* @ORM\Entity(repositoryClass="App\Repository\UserRepository")
2018-09-05 15:46:14 +02:00
*/
2018-09-06 12:58:36 +02:00
class User extends AbstractSource implements UserInterface, \Serializable
2018-09-05 15:46:14 +02:00
{
2018-09-06 11:57:32 +02:00
/**
* @ORM\Column(type="string", length=25, unique=true)
*/
private $username;
/**
* @ORM\Column(type="string", length=64)
*/
private $password;
/**
* @ORM\Column(type="string", length=254, unique=true)
*/
private $email;
/**
* @ORM\Column(name="is_active", type="boolean")
*/
private $isActive;
public function __construct()
{
$this->isActive = true;
// may not be needed, see section on salt below
// $this->salt = md5(uniqid('', true));
}
public function getUsername()
{
return $this->username;
}
2018-09-05 15:46:14 +02:00
2018-09-06 11:57:32 +02:00
public function getSalt()
{
// you *may* need a real salt depending on your encoder
// see section on salt below
return null;
}
public function getPassword()
{
return $this->password;
}
public function getRoles()
{
return array('ROLE_USER');
}
public function eraseCredentials()
{
}
/** @see \Serializable::serialize() */
public function serialize()
{
return serialize(array(
$this->id,
$this->username,
$this->password,
// see section on salt below
// $this->salt,
));
}
/** @see \Serializable::unserialize() */
public function unserialize($serialized)
{
list (
$this->id,
$this->username,
$this->password,
// see section on salt below
// $this->salt
) = unserialize($serialized, array('allowed_classes' => false));
}
}