src/Entity/ServiceOrderHistory.php line 44

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