src/Entity/ServiceOrderHistory.php line 41

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