src/Entity/Calculations.php line 40

  1. <?php
  2. namespace App\Entity;
  3. use ApiPlatform\Metadata\ApiResource;
  4. use App\Repository\CalculationsRepository;
  5. use Doctrine\DBAL\Types\Types;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use ApiPlatform\Metadata\ApiFilter;
  8. use ApiPlatform\Doctrine\Orm\Filter\SearchFilter;
  9. use Symfony\Component\Serializer\Annotation\Groups;
  10. use ApiPlatform\Metadata\Get;
  11. use ApiPlatform\Metadata\GetCollection;
  12. use ApiPlatform\Metadata\Delete;
  13. use ApiPlatform\Metadata\Put;
  14. use ApiPlatform\Metadata\Post;
  15. use App\Controller\CalculationsController;
  16. #[ORM\Entity(repositoryClassCalculationsRepository::class)]
  17. #[ApiResource(
  18.     operations: [
  19.         new Get(),
  20.         new Post(),
  21.         new Delete(),
  22.         new GetCollection(),
  23.         new Put(),
  24.         new Post(
  25.             name'clear_calculations',
  26.             uriTemplate'/calculations/clear'
  27.             controllerCalculationsController::class
  28.         )
  29.     ],
  30.     normalizationContext: ['groups' => ['calculations:read']],
  31.     denormalizationContext: ['groups' => ['calculations:write''agreements:read''agreements:write']],
  32.     order: ['date' => 'ASC']
  33. )]
  34. #[ApiFilter(SearchFilter::class, properties: ['agreement.id' => 'exact'])]
  35. class Calculations
  36. {
  37.     #[ORM\Id]
  38.     #[ORM\GeneratedValue
  39.     #[ORM\Column]
  40.     #[Groups(['calculations:read''calculations:write''agreements:read''agreements:write'])]
  41.     private ?int $id null;
  42.     #[Groups(['calculations:read''calculations:write''agreements:read''agreements:write'])]
  43.     #[ORM\Column(length255nullabletrue)]
  44.     private ?string $name null;
  45.     #[Groups(['calculations:read''calculations:write''agreements:read''agreements:write'])]
  46.     #[ORM\Column(nullabletrue)]
  47.     private ?float $initialBalance null;
  48.     #[Groups(['calculations:read''calculations:write''agreements:read''agreements:write'])]
  49.     #[ORM\Column(nullabletrue)]
  50.     private ?float $coming null;
  51.     #[Groups(['calculations:read''calculations:write''agreements:read''agreements:write'])]
  52.     #[ORM\Column(nullabletrue)]
  53.     private ?float $discharge null;
  54.     #[Groups(['calculations:read''calculations:write''agreements:read''agreements:write'])]
  55.     #[ORM\Column(nullabletrue)]
  56.     private ?float $finalBalance null;
  57.     #[Groups(['calculations:read''calculations:write''agreements:read''agreements:write'])]
  58.     #[ORM\Column(length255nullabletrue)]
  59.     private ?string $movementDocument null;
  60.     #[Groups(['calculations:read''calculations:write''agreements:read''agreements:write'])]
  61.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  62.     private ?\DateTimeInterface $date null;
  63.     #[Groups(['calculations:read''calculations:write''agreements:read''agreements:write'])]
  64.     #[ORM\ManyToOne(inversedBy'calculations')]
  65.     private ?Agreements $agreement null;
  66.     #[Groups(['calculations:read''calculations:write''agreements:read''agreements:write'])]
  67.     #[ORM\Column(length100nullabletrue)]
  68.     private ?string $agreementType null;
  69.     #[Groups(['calculations:read''calculations:write''agreements:read''agreements:write'])]
  70.     #[ORM\Column(length100nullabletrue)]
  71.     private ?string $typeMutualSettlements null;
  72.     #[Groups(['calculations:read''calculations:write''agreements:read''agreements:write'])]
  73.     #[ORM\Column(length100nullabletrue)]
  74.     private ?string $oragnazationName null;
  75.     #[Groups(['calculations:read''calculations:write''agreements:read''agreements:write'])]
  76.     #[ORM\ManyToOne(inversedBy'calculations')]
  77.     private ?Orders $orders null;
  78.     #[Groups(['calculations:read''calculations:write''agreements:read''agreements:write'])]
  79.     #[ORM\Column(length100nullabletrue)]
  80.     private ?string $code1c null;
  81.     #[Groups(['calculations:read''calculations:write''agreements:read''agreements:write'])]
  82.     #[ORM\Column(nullabletrue)]
  83.     private ?int $sort null;
  84.     public function getId(): ?int
  85.     {
  86.         return $this->id;
  87.     }
  88.     public function getName(): ?string
  89.     {
  90.         return $this->name;
  91.     }
  92.     public function setName(?string $name): self
  93.     {
  94.         $this->name $name;
  95.         return $this;
  96.     }
  97.     public function getInitialBalance(): ?float
  98.     {
  99.         return $this->initialBalance;
  100.     }
  101.     public function setInitialBalance(?float $initialBalance): self
  102.     {
  103.         $this->initialBalance $initialBalance;
  104.         return $this;
  105.     }
  106.     public function getComing(): ?float
  107.     {
  108.         return $this->coming;
  109.     }
  110.     public function setComing(?float $coming): self
  111.     {
  112.         $this->coming $coming;
  113.         return $this;
  114.     }
  115.     public function getDischarge(): ?float
  116.     {
  117.         return $this->discharge;
  118.     }
  119.     public function setDischarge(?float $discharge): self
  120.     {
  121.         $this->discharge $discharge;
  122.         return $this;
  123.     }
  124.     public function getFinalBalance(): ?float
  125.     {
  126.         return $this->finalBalance;
  127.     }
  128.     public function setFinalBalance(?float $finalBalance): self
  129.     {
  130.         $this->finalBalance $finalBalance;
  131.         return $this;
  132.     }
  133.     public function getMovementDocument(): ?string
  134.     {
  135.         return $this->movementDocument;
  136.     }
  137.     public function setMovementDocument(?string $movementDocument): self
  138.     {
  139.         $this->movementDocument $movementDocument;
  140.         return $this;
  141.     }
  142.     public function getDate(): ?\DateTimeInterface
  143.     {
  144.         return $this->date;
  145.     }
  146.     public function setDate(?\DateTimeInterface $date): self
  147.     {
  148.         $this->date $date;
  149.         return $this;
  150.     }
  151.     public function getAgreement(): ?Agreements
  152.     {
  153.         return $this->agreement;
  154.     }
  155.     public function setAgreement(?Agreements $agreement): self
  156.     {
  157.         $this->agreement $agreement;
  158.         return $this;
  159.     }
  160.     public function getAgreementType(): ?string
  161.     {
  162.         return $this->agreementType;
  163.     }
  164.     public function setAgreementType(?string $agreementType): self
  165.     {
  166.         $this->agreementType $agreementType;
  167.         return $this;
  168.     }
  169.     public function getTypeMutualSettlements(): ?string
  170.     {
  171.         return $this->typeMutualSettlements;
  172.     }
  173.     public function setTypeMutualSettlements(?string $typeMutualSettlements): self
  174.     {
  175.         $this->typeMutualSettlements $typeMutualSettlements;
  176.         return $this;
  177.     }
  178.     public function getOragnazationName(): ?string
  179.     {
  180.         return $this->oragnazationName;
  181.     }
  182.     public function setOragnazationName(?string $oragnazationName): self
  183.     {
  184.         $this->oragnazationName $oragnazationName;
  185.         return $this;
  186.     }
  187.     public function getOrders(): ?Orders
  188.     {
  189.         return $this->orders;
  190.     }
  191.     public function setOrders(?Orders $orders): self
  192.     {
  193.         $this->orders $orders;
  194.         return $this;
  195.     }
  196.     public function getCode1c(): ?string
  197.     {
  198.         return $this->code1c;
  199.     }
  200.     public function setCode1c(?string $code1c): static
  201.     {
  202.         $this->code1c $code1c;
  203.         return $this;
  204.     }
  205.     public function getSort(): ?int
  206.     {
  207.         return $this->sort;
  208.     }
  209.     public function setSort(?int $sort): static
  210.     {
  211.         $this->sort $sort;
  212.         return $this;
  213.     }
  214. }