src/Entity/Caixa.php line 12

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\CaixaRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\DBAL\Types\Types;
  7. use Doctrine\ORM\Mapping as ORM;
  8. #[ORM\Entity(repositoryClassCaixaRepository::class)]
  9. class Caixa
  10. {
  11.     #[ORM\Id]
  12.     #[ORM\GeneratedValue]
  13.     #[ORM\Column]
  14.     private ?int $id null;
  15.     #[ORM\Column(length255)]
  16.     private ?string $nome null;
  17.    // Propriedade que mapeia a relação ManyToMany
  18.    #[ORM\ManyToMany(targetEntityCliente::class, inversedBy'caixas')]
  19.    #[ORM\JoinTable(
  20.        name'caixa_cliente',
  21.        joinColumns: [new ORM\JoinColumn(name'cliente_id'referencedColumnName'id')],
  22.        inverseJoinColumns: [new ORM\JoinColumn(name'caixa_id'referencedColumnName'id')]
  23.     )]
  24.     private Collection $clientes;
  25.     #[ORM\Column]
  26.     private ?\DateTimeImmutable $createdAt null;
  27.     #[ORM\OneToMany(mappedBy'caixa'targetEntityDocumento::class)]
  28.     private Collection $documentos;
  29.     #[ORM\Column(typeTypes::DATE_MUTABLEnullabletrue)]
  30.     private ?\DateTimeInterface $data null;
  31.     #[ORM\Column(length255nullabletrue)]
  32.     private ?string $assunto null;
  33.     #[ORM\ManyToOne(inversedBy'caixas')]
  34.     private ?Fluxo $fluxo null;
  35.     #[ORM\ManyToOne(inversedBy'caixas')]
  36.     private ?Cx $cx null;
  37.     #[ORM\ManyToOne(inversedBy'caixa')]
  38.     private ?Etapa $etapa null;
  39.     
  40.     #[ORM\Column(nullabletrue)]
  41.     private ?\DateTimeImmutable $higienizaAt null;
  42.     public function __construct()
  43.     {
  44.         $this->clientes = new ArrayCollection();
  45.         $this->documentos = new ArrayCollection(); 
  46.         $this->createdAt = new \DateTimeImmutable('America/Sao_Paulo');
  47.     }
  48.     public function getId(): ?int
  49.     {
  50.         return $this->id;
  51.     }
  52.     public function getNome(): ?string
  53.     {
  54.         return $this->nome;
  55.     }
  56.     public function setNome(string $nome): static
  57.     {
  58.         $this->nome $nome;
  59.         return $this;
  60.     }
  61.     /**
  62.      * @return Collection<int, Cliente>
  63.      */
  64.     public function getClientes(): Collection
  65.     {
  66.         return $this->clientes;
  67.     }
  68.     public function addCliente(Cliente $cliente): static
  69.     {
  70.         if (!$this->clientes->contains($cliente)) {
  71.             $this->clientes->add($cliente);
  72.         }
  73.         return $this;
  74.     }
  75.     public function removeCliente(Cliente $cliente): static
  76.     {
  77.         $this->clientes->removeElement($cliente);
  78.         return $this;
  79.     }
  80.     public function getCreatedAt(): ?\DateTimeImmutable
  81.     {
  82.         return $this->createdAt;
  83.     }
  84.     public function setCreatedAt(\DateTimeImmutable $createdAt): static
  85.     {
  86.         $this->createdAt $createdAt;
  87.         return $this;
  88.     }
  89.     /**
  90.      * @return Collection<int, Documento>
  91.      */
  92.     public function getDocumentos(): Collection
  93.     {
  94.         return $this->documentos;
  95.     }
  96.     public function addDocumento(Documento $documento): static
  97.     {
  98.         if (!$this->documentos->contains($documento)) {
  99.             $this->documentos->add($documento);
  100.             $documento->setCaixa($this);
  101.         }
  102.         return $this;
  103.     }
  104.     public function removeDocumento(Documento $documento): static
  105.     {
  106.         if ($this->documentos->removeElement($documento)) {
  107.             // set the owning side to null (unless already changed)
  108.             if ($documento->getCaixa() === $this) {
  109.                 $documento->setCaixa(null);
  110.             }
  111.         }
  112.         return $this;
  113.     }
  114.     public function getData(): ?\DateTimeInterface
  115.     {
  116.         return $this->data;
  117.     }
  118.     public function setData(?\DateTimeInterface $data): static
  119.     {
  120.         $this->data $data;
  121.         return $this;
  122.     }
  123.     public function getAssunto(): ?string
  124.     {
  125.         return $this->assunto;
  126.     }
  127.     public function setAssunto(?string $assunto): static
  128.     {
  129.         $this->assunto $assunto;
  130.         return $this;
  131.     }
  132.     public function getFluxo(): ?Fluxo
  133.     {
  134.         return $this->fluxo;
  135.     }
  136.     public function setFluxo(?Fluxo $fluxo): static
  137.     {
  138.         $this->fluxo $fluxo;
  139.         return $this;
  140.     }
  141.     public function getCx(): ?Cx
  142.     {
  143.         return $this->cx;
  144.     }
  145.     public function setCx(?Cx $cx): static
  146.     {
  147.         $this->cx $cx;
  148.         return $this;
  149.     }
  150.     public function getEtapa(): ?Etapa
  151.     {
  152.         return $this->etapa;
  153.     }
  154.     public function setEtapa(?Etapa $etapa): static
  155.     {
  156.         $this->etapa $etapa;
  157.         return $this;
  158.     }
  159.     public function getHigienizaAt(): ?\DateTimeImmutable
  160.     {
  161.         return $this->higienizaAt;
  162.     }
  163.     public function setHigienizaAt(?\DateTimeImmutable $higienizaAt): static
  164.     {
  165.         $this->higienizaAt $higienizaAt;
  166.         return $this;
  167.     }
  168. }