<?php
namespace App\Application\Sonata\UserBundle\Entity;
use App\Entity\BoletimMedicao;
use App\Entity\Cliente;
use App\Entity\Colaborador;
use App\Entity\CompanyDataRestrictable;
use App\Entity\ContratoCliente;
use App\Entity\DiarioObra;
use App\Entity\Empresa;
use App\Entity\FluxoCaixa;
use App\Entity\Fornecedor;
use App\Entity\OrdemDeServico;
use App\Entity\PerfilUser;
use App\Entity\PropostaComercial;
use App\Entity\RelatorioTecnico;
use App\Entity\Servico;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Sonata\UserBundle\Entity\BaseUser as BaseUser;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Symfony\Component\Serializer\Annotation\Groups;
use Symfony\Component\Validator\Constraints as Assert;
/**
* This file has been generated by the SonataEasyExtendsBundle.
*
* @link https://sonata-project.org/easy-extends
*
* References:
* @link http://www.doctrine-project.org/projects/orm/2.0/docs/reference/working-with-objects/en
*
* @UniqueEntity("username", message="Já existe alguém cadastrado com este nome de usuário.")
* @UniqueEntity("email")
* @UniqueEntity("cpfCnpj")
*/
class User extends BaseUser implements CompanyDataRestrictable
{
/**
* @var int $id
* @Groups({"read"})
*/
protected $id;
/**
* @var string
* @Groups({"read", "write"})
* @Assert\NotBlank(groups={"Default","Registration","Profile"})
*/
protected $username;
/**
* @var string
* @Assert\NotBlank(groups={"Registration"})
*/
protected $plainPassword;
/**
* @var string
* @Groups({"read", "write"})
* @Assert\NotBlank(groups={"Default","Registration","Profile"})
* @Assert\Email(checkHost=true, groups={"Default","Registration","Profile"})
*/
protected $email;
/**
* @var string
* @Groups({"read", "write"})
* Assert\NotBlank(groups={"Default","Registration","Profile"})
* AppAssert\CpfCnpj(mask=false)
*/
protected $cpfCnpj;
/**
* @var string
* @Groups({"read", "write"})
* @Assert\NotBlank(groups={"Default","Registration","Profile"})
*/
protected $firstname;
/**
* @var string
* @Groups({"read", "write"})
*/
protected $lastname;
/**
* @var string
* @Groups({"read"})
*/
protected $nome;
/**
* @var string Path of file
* @ORM\Column(type="string", length=255, nullable=true)
*/
protected $avatarOriginal;
/**
* @var string
*
* @ORM\Column(type="string", length=255, nullable=true)
* @Groups({"read", "write"})
*/
private $avatar;
/**
* @var string
* @Groups({"read", "write"})
* Assert\NotBlank(groups={"Default","Registration","Profile"})
*/
protected $uf = 'GO';
/**
* @var string
* @Groups({"read", "write"})
*/
protected $gender;
/**
* @var string
* @Groups({"read", "write"})
*/
protected $phone;
/**
* @var \DateTime
* @Groups({"read", "write"})
*/
protected $dateOfBirth;
/**
* @var \DateTime
* @Groups({"read", "write"})
*/
protected $createdAt;
/**
* @var \DateTime
* @Groups({"read", "write"})
*/
protected $updatedAt;
/**
* @var UploadedFile
* @Groups({"none"})
*/
private $avatarFile;
private $status = true;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Empresa", inversedBy="usuarios")
*/
private $franquia;
/**
* @ORM\OneToMany(targetEntity="App\Entity\Empresa", mappedBy="usuarioAdmin")
*/
private $empresas;
/**
* @ORM\OneToMany(targetEntity="App\Entity\Servico", mappedBy="lastUpdatedUserAt")
*/
private $servicosAlterados;
/**
* @ORM\OneToMany(targetEntity="App\Entity\PropostaComercial", mappedBy="cadastradoPor")
*/
private $propostasComerciais;
/**
* @ORM\OneToMany(targetEntity="App\Entity\OrdemSeServico", mappedBy="cadastradoPor")
*/
private $ordensDeServico;
/**
* @ORM\OneToMany(targetEntity="App\Entity\Fornecedor", mappedBy="cadastradoPor")
*/
private $fornecedores;
/**
* @ORM\OneToMany(targetEntity="App\Entity\Colaborador", mappedBy="cadastradoPor")
*/
private $colaboradores;
/**
* @ORM\OneToMany(targetEntity="App\Entity\ContratoCliente", mappedBy="cadastradoPor")
*/
private $contratos;
/**
* @ORM\OneToMany(targetEntity="App\Entity\DiarioObra", mappedBy="cadastradoPor")
*/
private $diariosDeObra;
/**
* @ORM\OneToMany(targetEntity="App\Entity\BoletimMedicao", mappedBy="cadastradoPor")
*/
private $boletins;
/**
* @ORM\OneToMany(targetEntity="App\Entity\RelatorioTecnico", mappedBy="cadastradoPor")
*/
private $relatoriosTecnicos;
/**
* @ORM\OneToMany(targetEntity="App\Entity\FluxoCaixa", mappedBy="cadastradoPor")
*/
private $fluxosCaixa;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Empresa", inversedBy="cadastradoPor")
*/
private $clientes;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Empresa", inversedBy="cadastradoPor")
*/
private $contasReceber;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Empresa", inversedBy="usuarioAdmin")
*/
private $empresasUsuarios;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\ArquivoColaborador", inversedBy="cadastradoPor")
*/
private $arquivosColaborador;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\ArquivoOs", inversedBy="cadastradoPor")
*/
private $arquivosOs;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\ArquivoEmpresa", inversedBy="cadastradoPor")
*/
private $arquivosEmpresa;
public function __construct()
{
parent::__construct();
$this->empresas = new ArrayCollection();
$this->servicosAlterados = new ArrayCollection();
$this->propostasComerciais = new ArrayCollection();
$this->ordensDeServico = new ArrayCollection();
$this->fornecedores = new ArrayCollection();
$this->colaboradores = new ArrayCollection();
$this->contratos = new ArrayCollection();
$this->diariosDeObra = new ArrayCollection();
$this->boletins = new ArrayCollection();
$this->relatoriosTecnicos = new ArrayCollection();
$this->fluxosCaixa = new ArrayCollection();
$this->clientes = new ArrayCollection();
$this->contasReceber = new ArrayCollection();
$this->empresasUsuarios = new ArrayCollection();
}
/**
* Get id.
*
* @return int $id
*/
public function getId()
{
return $this->id;
}
/**
* @return string
*/
public function getCpfCnpj(): ?string
{
return $this->cpfCnpj;
}
/**
* @param string $cpfCnpj
* @return User
*/
public function setCpfCnpj($cpfCnpj): User
{
$this->cpfCnpj = $cpfCnpj;
return $this;
}
/**
* @return string
*/
public function getUf(): ?string
{
return $this->uf;
}
public function setUf(?string $uf): self
{
$this->uf = $uf;
return $this;
}
/**
* @return string
*/
public function getAvatarOriginal(): ?string
{
return $this->avatarOriginal;
}
/**
* @param string $avatarOriginal
* @return User
*/
public function setAvatarOriginal(?string $avatarOriginal): self
{
$this->avatarOriginal = $avatarOriginal;
return $this;
}
/**
* @return string
*/
public function getAvatar(): ?string
{
return $this->avatar;
}
/**
* @param string $avatar
* @return User
*/
public function setAvatar(?string $avatar): self
{
$this->avatar = $avatar;
return $this;
}
/**
* @return string
*/
public function getNome(): string
{
return trim($this->firstname . " " . $this->lastname);
}
/**
* @return UploadedFile
*/
public function getAvatarFile(): ?UploadedFile
{
return $this->avatarFile;
}
/**
* @param UploadedFile $avatarFile
* @return User
*/
public function setAvatarFile(UploadedFile $avatarFile = null): self
{
$this->avatarFile = $avatarFile;
return $this;
}
public function getFranquia(): ?Empresa
{
return $this->franquia;
}
public function setFranquia(?Empresa $franquia): self
{
$this->franquia = $franquia;
return $this;
}
/**
* @return Collection|Empresa[]
*/
public function getEmpresas(): Collection
{
return $this->empresas;
}
public function addEmpresa(Empresa $empresa): self
{
if (!$this->empresas->contains($empresa)) {
$this->empresas[] = $empresa;
$empresa->setUsuarioAdmin($this);
}
return $this;
}
public function removeEmpresa(Empresa $empresa): self
{
if ($this->empresas->contains($empresa)) {
$this->empresas->removeElement($empresa);
// set the owning side to null (unless already changed)
if ($empresa->getUsuarioAdmin() === $this) {
$empresa->setUsuarioAdmin(null);
}
}
return $this;
}
/**
* @return Collection|Servico[]
*/
public function getServicosAlterados(): Collection
{
return $this->servicosAlterados;
}
public function addServicosAlterado(Servico $servicosAlterado): self
{
if (!$this->servicosAlterados->contains($servicosAlterado)) {
$this->servicosAlterados[] = $servicosAlterado;
$servicosAlterado->setLastUpdatedUserAt($this);
}
return $this;
}
public function removeServicosAlterado(Servico $servicosAlterado): self
{
if ($this->servicosAlterados->contains($servicosAlterado)) {
$this->servicosAlterados->removeElement($servicosAlterado);
// set the owning side to null (unless already changed)
if ($servicosAlterado->getLastUpdatedUserAt() === $this) {
$servicosAlterado->setLastUpdatedUserAt(null);
}
}
return $this;
}
/**
* @return Collection|PropostaComercial[]
*/
public function getPropostasComerciais(): Collection
{
return $this->propostasComerciais;
}
public function addPropostasComerciai(PropostaComercial $propostasComerciai): self
{
if (!$this->propostasComerciais->contains($propostasComerciai)) {
$this->propostasComerciais[] = $propostasComerciai;
$propostasComerciai->setCadastradoPor($this);
}
return $this;
}
public function removePropostasComerciai(PropostaComercial $propostasComerciai): self
{
if ($this->propostasComerciais->contains($propostasComerciai)) {
$this->propostasComerciais->removeElement($propostasComerciai);
// set the owning side to null (unless already changed)
if ($propostasComerciai->getCadastradoPor() === $this) {
$propostasComerciai->setCadastradoPor(null);
}
}
return $this;
}
/**
* @return Collection|OrdemDeServico[]
*/
public function getOrdensDeServico(): Collection
{
return $this->propostasComerciais;
}
public function addOrdemDeServico(OrdemDeServico $ordemDeServico): self
{
if (!$this->ordensDeServico->contains($ordemDeServico)) {
$this->ordensDeServico[] = $ordemDeServico;
$ordemDeServico->setCadastradoPor($this);
}
return $this;
}
public function removeOrdemDeServico(OrdemDeServico $ordemDeServico): self
{
if ($this->ordensDeServico->contains($ordemDeServico)) {
$this->ordensDeServico->removeElement($ordemDeServico);
// set the owning side to null (unless already changed)
if ($ordemDeServico->getCadastradoPor() === $this) {
$ordemDeServico->setCadastradoPor(null);
}
}
return $this;
}
/**
* @return Collection|Fornecedor[]
*/
public function getFornecedores(): Collection
{
return $this->fornecedores;
}
public function addFornecedor(OrdemDeServico $fornecedor): self
{
if (!$this->fornecedores->contains($fornecedor)) {
$this->fornecedores[] = $fornecedor;
$fornecedor->setCadastradoPor($this);
}
return $this;
}
public function removeFornecedor(OrdemDeServico $fornecedor): self
{
if ($this->fornecedores->contains($fornecedor)) {
$this->fornecedores->removeElement($fornecedor);
// set the owning side to null (unless already changed)
if ($fornecedor->getCadastradoPor() === $this) {
$fornecedor->setCadastradoPor(null);
}
}
return $this;
}
/**
* @return Collection|Colaborador[]
*/
public function getColaboradores(): Collection
{
return $this->colaboradores;
}
public function addColaborador(Colaborador $colaborador): self
{
if (!$this->colaboradores->contains($colaborador)) {
$this->colaboradores[] = $colaborador;
$colaborador->setCadastradoPor($this);
}
return $this;
}
public function removeColaborador(Colaborador $colaborador): self
{
if ($this->colaboradores->contains($colaborador)) {
$this->colaboradores->removeElement($colaborador);
// set the owning side to null (unless already changed)
if ($colaborador->getCadastradoPor() === $this) {
$colaborador->setCadastradoPor(null);
}
}
return $this;
}
/**
* @return Collection|ContratoCliente[]
*/
public function getContratos(): Collection
{
return $this->contratos;
}
public function addContrato(ContratoCliente $contrato): self
{
if (!$this->contratos->contains($contrato)) {
$this->contratos[] = $contrato;
$contrato->setCadastradoPor($this);
}
return $this;
}
public function removeContrato(ContratoCliente $contrato): self
{
if ($this->contratos->contains($contrato)) {
$this->contratos->removeElement($contrato);
// set the owning side to null (unless already changed)
if ($contrato->getCadastradoPor() === $this) {
$contrato->setCadastradoPor(null);
}
}
return $this;
}
/**
* @return Collection|DiarioObra[]
*/
public function getDiariosObra(): Collection
{
return $this->diariosDeObra;
}
public function addDiariosObra(DiarioObra $diarioObra): self
{
if (!$this->diariosDeObra->contains($diarioObra)) {
$this->diariosDeObra[] = $diarioObra;
$diarioObra->setCadastradoPor($this);
}
return $this;
}
public function removeDiarioObra(DiarioObra $diarioObra): self
{
if ($this->diariosDeObra->contains($diarioObra)) {
$this->diariosDeObra->removeElement($diarioObra);
// set the owning side to null (unless already changed)
if ($diarioObra->getCadastradoPor() === $this) {
$diarioObra->setCadastradoPor(null);
}
}
return $this;
}
/**
* @return Collection|BoletimMedicao[]
*/
public function getBoletins(): Collection
{
return $this->boletins;
}
public function addBoletim(BoletimMedicao $boletimMedicao): self
{
if (!$this->boletins->contains($boletimMedicao)) {
$this->boletins[] = $boletimMedicao;
$boletimMedicao->setCadastradoPor($this);
}
return $this;
}
public function removeBoletim(BoletimMedicao $boletimMedicao): self
{
if ($this->boletins->contains($boletimMedicao)) {
$this->boletins->removeElement($boletimMedicao);
// set the owning side to null (unless already changed)
if ($boletimMedicao->getCadastradoPor() === $this) {
$boletimMedicao->setCadastradoPor(null);
}
}
return $this;
}
/**
* @return Collection|RelatorioTecnico[]
*/
public function getRelatoriosTecnicos(): Collection
{
return $this->relatoriosTecnicos;
}
public function addRelatorioTecnico(RelatorioTecnico $relatorioTecnico): self
{
if (!$this->relatoriosTecnicos->contains($relatorioTecnico)) {
$this->relatoriosTecnicos[] = $relatorioTecnico;
$relatorioTecnico->setCadastradoPor($this);
}
return $this;
}
public function removeRelatorioTecnico(RelatorioTecnico $relatorioTecnico): self
{
if ($this->relatoriosTecnicos->contains($relatorioTecnico)) {
$this->relatoriosTecnicos->removeElement($relatorioTecnico);
// set the owning side to null (unless already changed)
if ($relatorioTecnico->getCadastradoPor() === $this) {
$relatorioTecnico->setCadastradoPor(null);
}
}
return $this;
}
/**
* @return Collection|FluxoCaixa[]
*/
public function getFluxosCaixa(): Collection
{
return $this->fluxosCaixa;
}
public function addFluxosCaixa(FluxoCaixa $fluxoCaixa): self
{
if (!$this->fluxosCaixa->contains($fluxoCaixa)) {
$this->fluxosCaixa[] = $fluxoCaixa;
$fluxoCaixa->setCadastradoPor($this);
}
return $this;
}
public function removeFluxosCaixa(FluxoCaixa $fluxoCaixa): self
{
if ($this->fluxosCaixa->contains($fluxoCaixa)) {
$this->fluxosCaixa->removeElement($fluxoCaixa);
// set the owning side to null (unless already changed)
if ($fluxoCaixa->getCadastradoPor() === $this) {
$fluxoCaixa->setCadastradoPor(null);
}
}
return $this;
}
/**
* @return Collection|Cliente[]
*/
public function getClientes(): Collection
{
return $this->clientes;
}
public function addCliente(Cliente $cliente): self
{
if (!$this->clientes->contains($cliente)) {
$this->clientes[] = $cliente;
$cliente->setCadastradoPor($this);
}
return $this;
}
public function removeCliente(Cliente $cliente): self
{
if ($this->clientes->contains($cliente)) {
$this->clientes->removeElement($cliente);
// set the owning side to null (unless already changed)
if ($cliente->getCadastradoPor() === $this) {
$cliente->setCadastradoPor(null);
}
}
return $this;
}
/**
* @return Collection|Empresa[]
*/
public function getEmpresasUsuarios(): Collection
{
return $this->empresasUsuarios;
}
public function addEmpresaUsuario(Empresa $empresa): self
{
if (!$this->empresasUsuarios->contains($empresa)) {
$this->empresasUsuarios[] = $empresa;
$empresa->setUsuarioAdmin($this);
}
return $this;
}
public function removeEmpresaUsuario(Empresa $empresa): self
{
if ($this->empresasUsuarios->contains($empresa)) {
$this->empresasUsuarios->removeElement($empresa);
// set the owning side to null (unless already changed)
if ($empresa->getUsuarioAdmin() === $this) {
$empresa->setUsuarioAdmin(null);
}
}
return $this;
}
}