src/Entity/IncomingInvoice.php line 22

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use ApiPlatform\Metadata\ApiResource;
  4. use App\Repository\IncomingInvoiceRepository;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\DBAL\Types\Types;
  8. use Doctrine\ORM\Mapping as ORM;
  9. use Symfony\Component\Serializer\Annotation\Groups;
  10. use ApiPlatform\Metadata\ApiFilter;
  11. use ApiPlatform\Doctrine\Orm\Filter\SearchFilter;
  12. #[ORM\Entity(repositoryClassIncomingInvoiceRepository::class)]
  13. #[ApiResource(
  14.     normalizationContext: ['groups' => ['incoming_invoice:read']],
  15.     denormalizationContext: ['groups' => ['incoming_invoice:write']],
  16.     order: ['id' => 'DESC'],
  17. )]
  18. // 'account.manager.id' => 'exact', 
  19. class IncomingInvoice
  20. {
  21.     #[Groups(['incoming_invoice:read''incoming_invoice:write'])]
  22.     #[ORM\Id]
  23.     #[ORM\GeneratedValue]
  24.     #[ORM\Column]
  25.     private ?int $id null;
  26.     #[Groups(['incoming_invoice:read''incoming_invoice:write'])]
  27.     #[ORM\Column(length255nullabletrue)]
  28.     private ?string $name null;
  29.     #[Groups(['incoming_invoice:read''incoming_invoice:write'])]
  30.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  31.     private ?\DateTimeInterface $dateEntered null;
  32.     #[Groups(['incoming_invoice:read''incoming_invoice:write'])]
  33.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  34.     private ?\DateTimeInterface $dateModified null;
  35.     #[Groups(['incoming_invoice:read''incoming_invoice:write'])]
  36.     #[ORM\Column(typeTypes::DATE_MUTABLEnullabletrue)]
  37.     private ?\DateTimeInterface $dateIncoming null;
  38.     #[Groups(['incoming_invoice:read''incoming_invoice:write'])]
  39.     #[ORM\ManyToOne]
  40.     private ?User $modified_user null;
  41.     #[Groups(['incoming_invoice:read''incoming_invoice:write'])]
  42.     #[ORM\ManyToOne]
  43.     private ?User $assignedUser null;
  44.     #[Groups(['incoming_invoice:read''incoming_invoice:write'])]
  45.     #[ORM\Column(length100nullabletrue)]
  46.     private ?string $status null;
  47.     #[Groups(['incoming_invoice:read''incoming_invoice:write'])]
  48.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  49.     private ?string $description null;
  50.     #[Groups(['incoming_invoice:read''incoming_invoice:write'])]
  51.     #[ORM\Column(length100nullabletrue)]
  52.     private ?string $invoiceType null;
  53.     #[Groups(['incoming_invoice:read''incoming_invoice:write'])]
  54.     #[ORM\Column(nullabletrue)]
  55.     private ?int $invoiceNumber null;
  56.     #[Groups(['incoming_invoice:read''incoming_invoice:write'])]
  57.     #[ORM\ManyToOne(inversedBy'invoice_supplier')]
  58.     private ?Accounts $supplier null;
  59.     #[Groups(['incoming_invoice:read''incoming_invoice:write'])]
  60.     #[ORM\Column(length20nullabletrue)]
  61.     private ?string $iddoc null;
  62.     #[Groups(['incoming_invoice:read''incoming_invoice:write'])]
  63.     #[ORM\Column(nullabletrue)]
  64.     private ?bool $synced null;
  65.     #[Groups(['incoming_invoice:read''incoming_invoice:write'])]
  66.     #[ORM\Column(length20nullabletrue)]
  67.     private ?string $currency null;
  68.     #[Groups(['incoming_invoice:read''incoming_invoice:write'])]
  69.     #[ORM\Column(nullabletrue)]
  70.     private ?float $currency_rate null;
  71.     #[Groups(['incoming_invoice:read''incoming_invoice:write'])]
  72.     #[ORM\Column(nullabletrue)]
  73.     private ?float $total null;
  74.     #[Groups(['incoming_invoice:read''incoming_invoice:write'])]
  75.     #[ORM\Column(nullabletrue)]
  76.     private ?float $total_nds null;
  77.     #[Groups(['incoming_invoice:read''incoming_invoice:write'])]
  78.     #[ORM\Column(length255nullabletrue)]
  79.     private ?string $code_1c null;
  80.     #[Groups(['incoming_invoice:read''incoming_invoice:write'])]
  81.     #[ORM\ManyToOne(inversedBy'incomingInvoices')]
  82.     private ?Storage $storage null;
  83.     #[Groups(['incoming_invoice:read''incoming_invoice:write'])]
  84.     #[ORM\OneToOne(mappedBy'c'cascade: ['persist''remove'])]
  85.     private ?IncomingInvoiceCstm $incomingInvoiceCstm null;
  86.     #[Groups(['incoming_invoice:read''incoming_invoice:write'])]
  87.     #[ORM\OneToMany(mappedBy'incoming_invoice'targetEntityIncomingInvoiceProduct::class)]
  88.     private Collection $incomingInvoiceProducts;
  89.     public function __construct()
  90.     {
  91.         $this->incomingInvoiceProducts = new ArrayCollection();
  92.     }
  93.     public function getId(): ?int
  94.     {
  95.         return $this->id;
  96.     }
  97.     public function getName(): ?string
  98.     {
  99.         return $this->name;
  100.     }
  101.     public function setName(?string $name): self
  102.     {
  103.         $this->name $name;
  104.         return $this;
  105.     }
  106.     public function getDateEntered(): ?\DateTimeInterface
  107.     {
  108.         return $this->dateEntered;
  109.     }
  110.     public function setDateEntered(?\DateTimeInterface $dateEntered): self
  111.     {
  112.         $this->dateEntered $dateEntered;
  113.         return $this;
  114.     }
  115.     public function getDateModified(): ?\DateTimeInterface
  116.     {
  117.         return $this->dateModified;
  118.     }
  119.     public function setDateModified(?\DateTimeInterface $dateModified): self
  120.     {
  121.         $this->dateModified $dateModified;
  122.         return $this;
  123.     }
  124.     public function getDateIncoming(): ?\DateTimeInterface
  125.     {
  126.         return $this->dateIncoming;
  127.     }
  128.     public function setDateIncoming(?\DateTimeInterface $dateIncoming): self
  129.     {
  130.         $this->dateIncoming $dateIncoming;
  131.         return $this;
  132.     }
  133.     public function getModifiedUser(): ?User
  134.     {
  135.         return $this->modified_user;
  136.     }
  137.     public function setModifiedUser(?User $modified_user_id): self
  138.     {
  139.         $this->modified_user $modified_user_id;
  140.         return $this;
  141.     }
  142.     public function getAssignedUser(): ?User
  143.     {
  144.         return $this->assignedUser;
  145.     }
  146.     public function setAssignedUse(?User $assignedUser_id): self
  147.     {
  148.         $this->assignedUser $assignedUser_id;
  149.         return $this;
  150.     }
  151.     public function getStatus(): ?string
  152.     {
  153.         return $this->status;
  154.     }
  155.     public function setStatus(?string $status): self
  156.     {
  157.         $this->status $status;
  158.         return $this;
  159.     }
  160.     public function getDescription(): ?string
  161.     {
  162.         return $this->description;
  163.     }
  164.     public function setDescription(?string $description): self
  165.     {
  166.         $this->description $description;
  167.         return $this;
  168.     }
  169.     public function getInvoiceType(): ?string
  170.     {
  171.         return $this->invoiceType;
  172.     }
  173.     public function setInvoiceType(?string $invoiceType): self
  174.     {
  175.         $this->invoiceType $invoiceType;
  176.         return $this;
  177.     }
  178.     public function getInvoiceNumber(): ?int
  179.     {
  180.         return $this->invoiceNumber;
  181.     }
  182.     public function setInvoiceNumber(?int $invoiceNumber): self
  183.     {
  184.         $this->invoiceNumber $invoiceNumber;
  185.         return $this;
  186.     }
  187.     public function getSupplier(): ?Accounts
  188.     {
  189.         return $this->supplier;
  190.     }
  191.     public function setSupplier(?Accounts $supplier): self
  192.     {
  193.         $this->supplier $supplier;
  194.         return $this;
  195.     }
  196.     public function getIddoc(): ?string
  197.     {
  198.         return $this->iddoc;
  199.     }
  200.     public function setIddoc(?string $iddoc): self
  201.     {
  202.         $this->iddoc $iddoc;
  203.         return $this;
  204.     }
  205.     public function isSynced(): ?bool
  206.     {
  207.         return $this->synced;
  208.     }
  209.     public function setSynced(?bool $synced): self
  210.     {
  211.         $this->synced $synced;
  212.         return $this;
  213.     }
  214.     public function getCurrency(): ?string
  215.     {
  216.         return $this->currency;
  217.     }
  218.     public function setCurrency(?string $currency): self
  219.     {
  220.         $this->currency $currency;
  221.         return $this;
  222.     }
  223.     public function getCurrencyRate(): ?float
  224.     {
  225.         return $this->currency_rate;
  226.     }
  227.     public function setCurrencyRate(?float $currency_rate): self
  228.     {
  229.         $this->currency_rate $currency_rate;
  230.         return $this;
  231.     }
  232.     public function getTotal(): ?float
  233.     {
  234.         return $this->total;
  235.     }
  236.     public function setTotal(?float $total): self
  237.     {
  238.         $this->total $total;
  239.         return $this;
  240.     }
  241.     public function getTotalNds(): ?float
  242.     {
  243.         return $this->total_nds;
  244.     }
  245.     public function setTotalNds(?float $total_nds): self
  246.     {
  247.         $this->total_nds $total_nds;
  248.         return $this;
  249.     }
  250.     public function getCode1c(): ?string
  251.     {
  252.         return $this->code_1c;
  253.     }
  254.     public function setCode1c(?string $code_1c): self
  255.     {
  256.         $this->code_1c $code_1c;
  257.         return $this;
  258.     }
  259.     public function getStorage(): ?Storage
  260.     {
  261.         return $this->storage;
  262.     }
  263.     public function setStorage(?Storage $storage): self
  264.     {
  265.         $this->storage $storage;
  266.         return $this;
  267.     }
  268.     public function getIncomingInvoiceCstm(): ?IncomingInvoiceCstm
  269.     {
  270.         return $this->incomingInvoiceCstm;
  271.     }
  272.     public function setIncomingInvoiceCstm(?IncomingInvoiceCstm $incomingInvoiceCstm): self
  273.     {
  274.         // unset the owning side of the relation if necessary
  275.         if ($incomingInvoiceCstm === null && $this->incomingInvoiceCstm !== null) {
  276.             $this->incomingInvoiceCstm->setC(null);
  277.         }
  278.         // set the owning side of the relation if necessary
  279.         if ($incomingInvoiceCstm !== null && $incomingInvoiceCstm->getC() !== $this) {
  280.             $incomingInvoiceCstm->setC($this);
  281.         }
  282.         $this->incomingInvoiceCstm $incomingInvoiceCstm;
  283.         return $this;
  284.     }
  285.     /**
  286.      * @return Collection<int, IncomingInvoiceProduct>
  287.      */
  288.     public function getIncomingInvoiceProducts(): Collection
  289.     {
  290.         return $this->incomingInvoiceProducts;
  291.     }
  292.     public function addIncomingInvoiceProduct(IncomingInvoiceProduct $incomingInvoiceProduct): self
  293.     {
  294.         if (!$this->incomingInvoiceProducts->contains($incomingInvoiceProduct)) {
  295.             $this->incomingInvoiceProducts->add($incomingInvoiceProduct);
  296.             $incomingInvoiceProduct->setIncomingInvoice($this);
  297.         }
  298.         return $this;
  299.     }
  300.     public function removeIncomingInvoiceProduct(IncomingInvoiceProduct $incomingInvoiceProduct): self
  301.     {
  302.         if ($this->incomingInvoiceProducts->removeElement($incomingInvoiceProduct)) {
  303.             // set the owning side to null (unless already changed)
  304.             if ($incomingInvoiceProduct->getIncomingInvoice() === $this) {
  305.                 $incomingInvoiceProduct->setIncomingInvoice(null);
  306.             }
  307.         }
  308.         return $this;
  309.     }
  310. }