src\Entity\Solicitacao.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\SolicitacaoRepository;
  4. use Doctrine\DBAL\Types\Types;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Symfony\Component\HttpFoundation\File\File;
  7. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  8. use App\Entity\Empresa;
  9. #[Vich\Uploadable]
  10. #[ORM\Entity(repositoryClassSolicitacaoRepository::class)]
  11. class Solicitacao
  12. {
  13.     const STATUS_PENDENTE 1;
  14.     const STATUS_APROVADOR_RECUSADO 2;
  15.     const STATUS_APROVADOR_OK 3;
  16.     const STATUS_ADMINISTRADOR_RECUSADO 4;
  17.     const STATUS_ADMINISTRADOR_OK 5;
  18.     const STATUS_TODOS 0;
  19.     #[ORM\Id]
  20.     #[ORM\GeneratedValue]
  21.     #[ORM\Column]
  22.     private ?int $id null;
  23.     #[ORM\ManyToOne(inversedBy'solicitacaos')]
  24.     #[ORM\JoinColumn(nullablefalse)]
  25.     private ?User $usuario null;
  26.     #[ORM\Column(length255)]
  27.     private ?string $titulo null;
  28.     /**
  29.      * DONO da relação com Empresa (inversedBy aponta para Empresa::$solicitacoes).
  30.      * nullable=true + onDelete=SET NULL para permitir setEmpresa(null) ao remover do lado da Empresa.
  31.      */
  32.     #[ORM\ManyToOne(targetEntityEmpresa::class, inversedBy'solicitacoes')]
  33.     #[ORM\JoinColumn(name'empresa_id'referencedColumnName'id'nullabletrueonDelete'SET NULL')]
  34.     private ?Empresa $empresa null;
  35.     #[ORM\ManyToOne(targetEntitySubEmpresa::class)]
  36.     #[ORM\JoinColumn(name'sub_empresa_id'referencedColumnName'id'nullabletrueonDelete'SET NULL')]
  37.     private ?SubEmpresa $subEmpresa null;
  38.     #[ORM\Column(length255nullabletrue)]
  39.     private ?string $notaFiscal null;
  40.     #[ORM\Column(length20nullabletrue)]
  41.     private ?string $numeroLancamento null;
  42.     #[ORM\Column(length9nullabletrue)]
  43.     private ?string $referencia null;
  44.     #[ORM\Column(length255nullabletrue)]
  45.     private ?string $fornecedor null;
  46.     #[ORM\Column]
  47.     private ?string $valor null;
  48.     #[ORM\Column(typeTypes::DATETIME_MUTABLE)]
  49.     private ?\DateTimeInterface $vencimento null;
  50.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  51.     private ?string $justificativa null;
  52.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  53.     private ?string $comentario null;
  54.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  55.     private ?string $recusa null;
  56.     #[ORM\Column(typeTypes::SMALLINT)]
  57.     private ?int $status null;
  58.     #[ORM\ManyToOne(inversedBy'aprovador')]
  59.     #[ORM\JoinColumn(nullabletrue)]
  60.     private ?User $aprovador null;
  61.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  62.     private ?\DateTimeInterface $approvedAt null;
  63.     #[ORM\ManyToOne(inversedBy'administrador')]
  64.     #[ORM\JoinColumn(nullabletrue)]
  65.     private ?User $administrador null;
  66.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  67.     private ?\DateTimeInterface $adminApprovedAt null;
  68.     #[ORM\ManyToOne(inversedBy'recusador')]
  69.     #[ORM\JoinColumn(nullabletrue)]
  70.     private ?User $recusador null;
  71.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  72.     private ?\DateTimeInterface $recusedAt null;
  73.     // NOTE: This is not a mapped field of entity metadata, just a simple property.
  74.     #[Vich\UploadableField(mapping'products'fileNameProperty'imageName')]
  75.     private ?File $imageFile null;
  76.     #[ORM\Column(type'string'nullabletrue)]
  77.     private ?string $imageName null;
  78.     #[ORM\Column(typeTypes::DATETIME_MUTABLE)]
  79.     private ?\DateTimeInterface $createdAt null;
  80.     #[ORM\Column(typeTypes::DATETIME_MUTABLE)]
  81.     private ?\DateTimeInterface $updatedAt null;
  82.     public function getId(): ?int
  83.     {
  84.         return $this->id;
  85.     }
  86.     public function getUsuario(): ?User
  87.     {
  88.         return $this->usuario;
  89.     }
  90.     public function setUsuario(?User $usuario): self
  91.     {
  92.         $this->usuario $usuario;
  93.         return $this;
  94.     }
  95.     public function getTitulo(): ?string
  96.     {
  97.         return $this->titulo;
  98.     }
  99.     public function setTitulo(string $titulo): self
  100.     {
  101.         $this->titulo $titulo;
  102.         return $this;
  103.     }
  104.     public function getNotaFiscal(): ?string
  105.     {
  106.         return $this->notaFiscal;
  107.     }
  108.     public function setNotaFiscal(?string $notaFiscal): self
  109.     {
  110.         $this->notaFiscal $notaFiscal;
  111.         return $this;
  112.     }
  113.     public function getValor(): ?string
  114.     {
  115.         return $this->valor;
  116.     }
  117.     public function setValor(string $valor): self
  118.     {
  119.         $this->valor $valor;
  120.         return $this;
  121.     }
  122.     public function getVencimento(): ?\DateTimeInterface
  123.     {
  124.         return $this->vencimento;
  125.     }
  126.     public function setVencimento(\DateTimeInterface $vencimento): self
  127.     {
  128.         $this->vencimento $vencimento;
  129.         return $this;
  130.     }
  131.     public function getJustificativa(): ?string
  132.     {
  133.         return $this->justificativa;
  134.     }
  135.     public function setJustificativa(?string $justificativa): self
  136.     {
  137.         $this->justificativa $justificativa;
  138.         return $this;
  139.     }
  140.     public function getComentario(): ?string
  141.     {
  142.         return $this->comentario;
  143.     }
  144.     public function setComentario(?string $comentario): self
  145.     {
  146.         $this->comentario $comentario;
  147.         return $this;
  148.     }
  149.     public function getRecusa(): ?string
  150.     {
  151.         return $this->recusa;
  152.     }
  153.     public function setRecusa(?string $recusa): self
  154.     {
  155.         $this->recusa $recusa;
  156.         return $this;
  157.     }
  158.     public function getStatus(): ?int
  159.     {
  160.         return $this->status;
  161.     }
  162.     public function setStatus(int $status): self
  163.     {
  164.         $this->status $status;
  165.         return $this;
  166.     }
  167.     public function getAprovador(): ?User
  168.     {
  169.         return $this->aprovador;
  170.     }
  171.     public function setAprovador(?User $aprovador): self
  172.     {
  173.         $this->aprovador $aprovador;
  174.         return $this;
  175.     }
  176.     public function getAdministrador(): ?User
  177.     {
  178.         return $this->administrador;
  179.     }
  180.     public function setAdministrador(?User $administrador): self
  181.     {
  182.         $this->administrador $administrador;
  183.         return $this;
  184.     }
  185.     /**
  186.      * If manually uploading a file (i.e. not using Symfony Form) ensure an instance
  187.      * of 'UploadedFile' is injected into this setter to trigger the update. If this
  188.      * bundle's configuration parameter 'inject_on_load' is set to 'true' this setter
  189.      * must be able to accept an instance of 'File' as the bundle will inject one here
  190.      * during Doctrine hydration.
  191.      */
  192.     public function setImageFile(?File $imageFile null): void
  193.     {
  194.         $this->imageFile $imageFile;
  195.         if (null !== $imageFile) {
  196.             // Qualquer mudança força o listener do Vich
  197.             $this->updatedAt = new \DateTime(); // compatível com DATETIME_MUTABLE
  198.         }
  199.     }
  200.     public function getImageFile(): ?File
  201.     {
  202.         return $this->imageFile;
  203.     }
  204.     public function setImageName(?string $imageName): void
  205.     {
  206.         $this->imageName $imageName;
  207.     }
  208.     public function getImageName(): ?string
  209.     {
  210.         return $this->imageName;
  211.     }
  212.     public function getCreatedAt(): ?\DateTimeInterface
  213.     {
  214.         return $this->createdAt;
  215.     }
  216.     public function setCreatedAt(\DateTimeInterface $createdAt): self
  217.     {
  218.         $this->createdAt $createdAt;
  219.         return $this;
  220.     }
  221.     public function getUpdatedAt(): ?\DateTimeInterface
  222.     {
  223.         return $this->updatedAt;
  224.     }
  225.     public function setUpdatedAt(\DateTimeInterface $updatedAt): self
  226.     {
  227.         $this->updatedAt $updatedAt;
  228.         return $this;
  229.     }
  230.     public function getEmpresa(): ?Empresa
  231.     {
  232.         return $this->empresa;
  233.     }
  234.     public function setEmpresa(?Empresa $empresa): self
  235.     {
  236.         $this->empresa $empresa;
  237.         return $this;
  238.     }
  239.     public function getSubEmpresa(): ?SubEmpresa
  240.     {
  241.         return $this->subEmpresa;
  242.     }
  243.     public function setSubEmpresa(?SubEmpresa $subEmpresa): self
  244.     {
  245.         $this->subEmpresa $subEmpresa;
  246.         return $this;
  247.     }
  248.     public function getRecusador(): ?User
  249.     {
  250.         return $this->recusador;
  251.     }
  252.     public function setRecusador(?User $recusador): self
  253.     {
  254.         $this->recusador $recusador;
  255.         return $this;
  256.     }
  257.     public function getNumeroLancamento(): ?string
  258.     {
  259.         return $this->numeroLancamento;
  260.     }
  261.     public function setNumeroLancamento(?string $numeroLancamento): self
  262.     {
  263.         $this->numeroLancamento $numeroLancamento;
  264.         return $this;
  265.     }
  266.     public function getReferencia(): ?string
  267.     {
  268.         return $this->referencia;
  269.     }
  270.     public function setReferencia(?string $referencia): self
  271.     {
  272.         $this->referencia $referencia;
  273.         return $this;
  274.     }
  275.     public function getFornecedor(): ?string
  276.     {
  277.         return $this->fornecedor;
  278.     }
  279.     public function setFornecedor(?string $fornecedor): self
  280.     {
  281.         $this->fornecedor $fornecedor;
  282.         return $this;
  283.     }
  284.     public function getApprovedAt(): ?\DateTimeInterface
  285.     {
  286.         return $this->approvedAt;
  287.     }
  288.     public function setApprovedAt(?\DateTimeInterface $approvedAt): self
  289.     {
  290.         $this->approvedAt $approvedAt;
  291.         return $this;
  292.     }
  293.     public function getAdminApprovedAt(): ?\DateTimeInterface
  294.     {
  295.         return $this->adminApprovedAt;
  296.     }
  297.     public function setAdminApprovedAt(?\DateTimeInterface $adminApprovedAt): self
  298.     {
  299.         $this->adminApprovedAt $adminApprovedAt;
  300.         return $this;
  301.     }
  302.     public function getRecusedAt(): ?\DateTimeInterface
  303.     {
  304.         return $this->recusedAt;
  305.     }
  306.     public function setRecusedAt(?\DateTimeInterface $recusedAt): self
  307.     {
  308.         $this->recusedAt $recusedAt;
  309.         return $this;
  310.     }
  311. }