src/Entity/ServiceOrderHistory.php line 40

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use ApiPlatform\Metadata\ApiResource;
  4. use App\Repository\ServiceOrderHistoryRepository;
  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 Symfony\Component\Serializer\Annotation\MaxDepth;
  11. use ApiPlatform\Core\Annotation\ApiProperty;
  12. use ApiPlatform\Metadata\Get;
  13. use ApiPlatform\Metadata\GetCollection;
  14. use ApiPlatform\Metadata\Post;
  15. use ApiPlatform\Metadata\Put;
  16. use ApiPlatform\Metadata\Delete;
  17. use App\Filter\ServiceOrderUserFilter;
  18. #[ORM\Entity(repositoryClassServiceOrderHistoryRepository::class)]
  19. #[ApiResource(
  20.     normalizationContext: ['groups' => ['service_history:read']],
  21.     denormalizationContext: ['groups' => ['service_history:write']],
  22.     order: ['id' => 'DESC'],
  23. )]
  24. #[ApiFilter(SearchFilter::class, properties: [
  25.     // 'personalAccount.id' => 'exact', 
  26.     // 'personalAccount.owner.id' => 'exact', 
  27. ])]
  28. #[Put(security"object.personalAccount.owner == user")]
  29. #[Get(security"object.personalAccount.owner == user")]
  30. #[GetCollection]
  31. #[Delete(security"object.personalAccount.owner == user")]
  32. #[Post(security"is_granted('ROLE_ADMIN')")]
  33. #[ApiFilter(ServiceOrderUserFilter::class)]
  34. class ServiceOrderHistory
  35. {
  36.     #[ORM\Id]
  37.     #[ORM\GeneratedValue]
  38.     #[ORM\Column]
  39.     #[Groups(['service_history:read''service_history:write'])]
  40.     private ?int $id null;
  41.     #[Groups(['service_history:read''service_history:write'])]
  42.     #[ORM\Column(length255nullabletrue)]
  43.     private ?string $name null;
  44.     #[Groups(['service_history:read''service_history:write'])]
  45.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  46.     private ?\DateTimeInterface $dateEntered null;
  47.     #[Groups(['service_history:read''service_history:write'])]
  48.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  49.     private ?\DateTimeInterface $dateModified null;
  50.     #[Groups(['service_history:read''service_history:write'])]
  51.     #[ORM\Column(length100nullabletrue)]
  52.     private ?string $type null;
  53.     #[Groups(['service_history:read''service_history:write'])]
  54.     #[ORM\Column(length100nullabletrue)]
  55.     private ?string $status null;
  56.     #[Groups(['service_history:read'])]
  57.     #[ORM\ManyToOne(inversedBy'serviceOrderHistories')]
  58.     private ?AppPersonalAccount $personalAccount null;
  59.     #[Groups(['service_history:read''service_history:write'])]
  60.     #[ORM\Column(length255nullabletrue)]
  61.     private ?string $pdf null;
  62.     #[Groups(['service_history:read''service_history:write'])]
  63.     #[ORM\Column(length100nullabletrue)]
  64.     private ?string $idCrm null;
  65.     #[Groups(['service_history:read''service_history:write'])]
  66.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  67.     private ?string $description null;
  68.     #[Groups(['service_history:read''service_history:write'])]
  69.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  70.     private ?string $message null;
  71.     #[Groups(['service_history:read''service_history:write'])]
  72.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  73.     private ?string $commentar null;
  74.     public function getId(): ?int
  75.     {
  76.         return $this->id;
  77.     }
  78.     public function getName(): ?string
  79.     {
  80.         return $this->name;
  81.     }
  82.     public function setName(?string $name): static
  83.     {
  84.         $this->name $name;
  85.         return $this;
  86.     }
  87.     public function getDateEntered(): ?\DateTimeInterface
  88.     {
  89.         return $this->dateEntered;
  90.     }
  91.     public function setDateEntered(?\DateTimeInterface $dateEntered): static
  92.     {
  93.         $this->dateEntered $dateEntered;
  94.         return $this;
  95.     }
  96.     public function getDateModified(): ?\DateTimeInterface
  97.     {
  98.         return $this->dateModified;
  99.     }
  100.     public function setDateModified(?\DateTimeInterface $dateModified): static
  101.     {
  102.         $this->dateModified $dateModified;
  103.         return $this;
  104.     }
  105.     public function getType(): ?string
  106.     {
  107.         return $this->type;
  108.     }
  109.     public function setType(?string $type): static
  110.     {
  111.         $this->type $type;
  112.         return $this;
  113.     }
  114.     public function getStatus(): ?string
  115.     {
  116.         return $this->status;
  117.     }
  118.     public function setStatus(?string $status): static
  119.     {
  120.         $this->status $status;
  121.         return $this;
  122.     }
  123.     public function getPersonalAccount(): ?AppPersonalAccount
  124.     {
  125.         return $this->personalAccount;
  126.     }
  127.     public function setPersonalAccount(?AppPersonalAccount $personalAccount): static
  128.     {
  129.         $this->personalAccount $personalAccount;
  130.         return $this;
  131.     }
  132.     public function getPdf(): ?string
  133.     {
  134.         return $this->pdf;
  135.     }
  136.     public function setPdf(?string $pdf): static
  137.     {
  138.         $this->pdf $pdf;
  139.         return $this;
  140.     }
  141.     public function getIdCrm(): ?string
  142.     {
  143.         return $this->idCrm;
  144.     }
  145.     public function setIdCrm(?string $idCrm): static
  146.     {
  147.         $this->idCrm $idCrm;
  148.         return $this;
  149.     }
  150.     public function getDescription(): ?string
  151.     {
  152.         return $this->description;
  153.     }
  154.     public function setDescription(?string $description): static
  155.     {
  156.         $this->description $description;
  157.         return $this;
  158.     }
  159.     public function getMessage(): ?string
  160.     {
  161.         return $this->message;
  162.     }
  163.     public function setMessage(?string $message): static
  164.     {
  165.         $this->message $message;
  166.         return $this;
  167.     }
  168.     public function getCommentar(): ?string
  169.     {
  170.         return $this->commentar;
  171.     }
  172.     public function setCommentar(?string $commentar): static
  173.     {
  174.         $this->commentar $commentar;
  175.         return $this;
  176.     }
  177. }