<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Symfony\Component\Security\Core\User\UserInterface;
/**
* Usuario
*
* @ORM\Table(name="usuario", indexes={@ORM\Index(name="usuario_unidad_id_uni_fk", columns={"unidad"}), @ORM\Index(name="usuario_rol_id_rol_fk", columns={"rol"})})
* @ORM\Entity
* @method string getUserIdentifier()
* @UniqueEntity(fields={"correo"}, message="Existe un usuario registrado con el mismo correo")
*/
class Usuario implements UserInterface, \Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface
{
/**
* @var int
*
* @ORM\Column(name="id_usu", type="integer", nullable=false)
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $idUsu;
/**
* @var string
*
* @ORM\Column(name="nombre", type="string", length=50, nullable=false)
*/
private $nombre;
/**
* @var string
*
* @ORM\Column(name="papellido", type="string", length=50, nullable=false)
*/
private $papellido;
/**
* @var string|null
*
* @ORM\Column(name="sapellido", type="string", length=50, nullable=true)
*/
private $sapellido;
/**
* @var string
*
* @ORM\Column(name="correo", type="string", length=80, nullable=false)
*/
private $correo;
/**
* @var string
*
* @ORM\Column(name="contrasena", type="string", length=100, nullable=false)
*/
private $contrasena;
/**
* @var \Unidad
*
* @ORM\ManyToOne(targetEntity="Unidad")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="unidad", referencedColumnName="id_uni")
* })
*/
private $unidad;
/**
* @var \Role
*
* @ORM\ManyToOne(targetEntity="Role")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="rol", referencedColumnName="id_rol")
* })
*/
private $rol;
/**
* @var string
*
* @ORM\Column(name="estatus", type="string", length=12, nullable=false)
*/
private $estatus;
public function getIdUsu(): ?int
{
return $this->idUsu;
}
public function getNombre(): ?string
{
return $this->nombre;
}
public function setNombre(string $nombre): self
{
$this->nombre = $nombre;
return $this;
}
public function getPapellido(): ?string
{
return $this->papellido;
}
public function setPapellido(?string $papellido): self
{
$this->papellido = $papellido;
return $this;
}
public function getSapellido(): ?string
{
return $this->sapellido;
}
public function setSapellido(?string $sapellido): self
{
$this->sapellido = $sapellido;
return $this;
}
public function getCorreo(): ?string
{
return $this->correo;
}
public function setCorreo(string $correo): self
{
$this->correo = $correo;
return $this;
}
public function getContrasena(): ?string
{
return $this->contrasena;
}
public function setContrasena(string $contrasena): self
{
$this->contrasena = $contrasena;
return $this;
}
public function getUnidad(): ?Unidad
{
return $this->unidad;
}
public function setUnidad(?Unidad $unidad): self
{
$this->unidad = $unidad;
return $this;
}
public function getRol(): ?Role
{
return $this->rol;
}
public function setRol(?Role $rol): self
{
$this->rol = $rol;
return $this;
}
public function getRoles()
{
return ['ROLE_PLANTEL'];
}
public function getPassword(): ?string
{
return $this->getContrasena();
}
public function getSalt()
{
return null;
}
public function eraseCredentials()
{
}
public function getUsername()
{
return $this->getCorreo();
}
public function __call($name, $arguments)
{
}
public function getEstatus(): string
{
return $this->estatus;
}
public function setEstatus(string $estatus): self
{
$this->estatus = $estatus;
return $this;
}
public function __toString()
{
return $this->nombre;
}
// Entidad de usuario
}