src/Entity/PropertyVisitReport.php line 58

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Entity;
  4. use ApiPlatform\Core\Annotation\ApiFilter;
  5. use ApiPlatform\Core\Annotation\ApiResource;
  6. use App\Repository\PropertyVisitReportRepository;
  7. use App\Traits\TimeStampTrait;
  8. use Doctrine\Common\Collections\ArrayCollection;
  9. use Doctrine\Common\Collections\Collection;
  10. use Doctrine\ORM\Mapping as ORM;
  11. use Symfony\Component\Serializer\Annotation\Groups;
  12. use Symfony\Component\Validator\Constraints as Assert;
  13. /**
  14.  * @ApiResource(
  15.  *     security= "is_granted('ROLE_AGENT') or is_granted('ROLE_MANAGER')",
  16.  *     normalizationContext={"groups"={"property-report:read"}, "swagger_definition_name"="Read"},
  17.  *     denormalizationContext={"groups"={"property-report:write"}, "swagger_definition_name"="Write"},
  18.  *     itemOperations={
  19.  *          "get" = {
  20.  *                     "path"="/property/visits/report/{id}",
  21.  *                      "security"="is_granted('ROLE_AGENT') or is_granted('ROLE_MANAGER')",
  22.  *                  },
  23.  *          "put" = {
  24.  *               "path"="/property/visits/report/{id}",
  25.  *               "denormalization_context"={"groups"={"property-visit-report:put"}},
  26.  *               "security"="is_granted('ROLE_AGENT') or is_granted('ROLE_MANAGER')",
  27.  *              },
  28.  *          "delete" = {
  29.  *                 "path"="/property/visits/report/{id}",
  30.  *                 "security"="is_granted('ROLE_AGENT') or is_granted('ROLE_MANAGER')",
  31.  *              },
  32.  *     },
  33.  *     collectionOperations={
  34.  *          "get" = {
  35.  *                  "path"="/property/visits/report",
  36.  *
  37.  *                 },
  38.  *          "post" = {
  39.  *                "path"="/property/visits/report",
  40.  *                "security_post_denormalize" = "is_granted('ROLE_AGENT') or is_granted('ROLE_MANAGER')"
  41.  *              }
  42.  *     },
  43.  *     attributes={
  44.  *          "pagination_items_per_page"=10,
  45.  *          "formats"={"jsonld", "json", "html", "jsonhal", "csv"={"text/csv"} },
  46.  *          "order"={"id":"DESC"}
  47.  *     }
  48.  * )
  49.  *
  50.  * @ORM\Entity(repositoryClass=PropertyVisitReportRepository::class)
  51.  * @ORM\HasLifecycleCallbacks()
  52.  * @ORM\EntityListeners({"App\EventListener\VisitReportListener"})
  53.  */
  54. class PropertyVisitReport
  55. {
  56.     use TimeStampTrait;
  57.     /**
  58.      * @ORM\Id
  59.      * @ORM\GeneratedValue
  60.      * @ORM\Column(type="integer")
  61.      * @Groups({"property-report:read", "property-visit:read"})
  62.      */
  63.     private int $id;
  64.     /**
  65.      * @ORM\ManyToOne(targetEntity=PropertyVisitVoucher::class, inversedBy="propertyVisitReports")
  66.      * @ORM\JoinColumn(nullable=false)
  67.      * @Groups({"property-report:read", "property-report:write"})
  68.      */
  69.     private PropertyVisitVoucher $visitVoucher;
  70.     /**
  71.      * @ORM\ManyToOne(targetEntity=Mandate::class)
  72.      * @ORM\JoinColumn(nullable=false)
  73.      * @Groups({"property-report:read", "property-report:write", "property-visit:read"})
  74.      */
  75.     private Mandate $mandate;
  76.     /**
  77.      * @ORM\Column(type="text", nullable=true)
  78.      * @Groups({"property-report:read", "property-report:write", "property-visit:read"})
  79.      */
  80.     private ?string $report;
  81.     public function getId(): ?int
  82.     {
  83.         return $this->id;
  84.     }
  85.     public function getVisitVoucher(): ?PropertyVisitVoucher
  86.     {
  87.         return $this->visitVoucher;
  88.     }
  89.     public function setVisitVoucher(?PropertyVisitVoucher $visitVoucher): self
  90.     {
  91.         $this->visitVoucher $visitVoucher;
  92.         return $this;
  93.     }
  94.     public function getMandate(): ?Mandate
  95.     {
  96.         return $this->mandate;
  97.     }
  98.     public function setMandate(?Mandate $mandate): self
  99.     {
  100.         $this->mandate $mandate;
  101.         return $this;
  102.     }
  103.     public function getReport(): ?string
  104.     {
  105.         return $this->report;
  106.     }
  107.     public function setReport(?string $report): self
  108.     {
  109.         $this->report $report;
  110.         return $this;
  111.     }
  112. }