src/Entity/Form.php line 23

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use ApiPlatform\Metadata\Post;
  4. use ApiPlatform\Metadata\GetCollection;
  5. use ApiPlatform\Metadata\Delete;
  6. use ApiPlatform\Metadata\Patch;
  7. use ApiPlatform\Metadata\Put;
  8. use ApiPlatform\Metadata\Get;
  9. use ApiPlatform\Metadata\ApiResource;
  10. use ApiPlatform\Metadata\ApiProperty;
  11. use ApiPlatform\Metadata\ApiFilter;
  12. use App\Repository\FormRepository;
  13. use Doctrine\Common\Collections\ArrayCollection;
  14. use Doctrine\Common\Collections\Collection;
  15. use Doctrine\DBAL\Types\Types;
  16. use Doctrine\ORM\Mapping as ORM;
  17. use Symfony\Component\Serializer\Annotation\Groups;
  18. #[ApiResource(operations: [new Get(), new Put(security'is_granted(\'ROLE_SUPER_ADMIN\')'securityMessage'Accès Interdit'), new Patch(security'is_granted(\'ROLE_SUPER_ADMIN\')'securityMessage'Accès Interdit'), new Delete(security'is_granted(\'ROLE_SUPER_ADMIN\')'securityMessage'Accès Interdit'), new GetCollection(), new Post(normalizationContext: ['groups' => ['get']], security'is_granted(\'ROLE_SUPER_ADMIN\')'securityMessage'Accès Interdit')])]
  19. #[ORM\Entity(repositoryClassFormRepository::class)]
  20. class Form
  21. {
  22.     #[ORM\Id]
  23.     #[Groups('get')]
  24.     #[ORM\GeneratedValue]
  25.     #[ORM\Column(type'integer')]
  26.     private ?int $id null;
  27.     #[Groups('get')]
  28.     #[ORM\Column(type'string'length255)]
  29.     private ?string $title null;
  30.     #[Groups('get')]
  31.     #[ORM\Column(type'boolean'nullabletrue)]
  32.     private ?bool $isActive null;
  33.     #[Groups('get')]
  34.     #[ORM\OneToMany(mappedBy'form'targetEntityAnswer::class, orphanRemovaltrue)]
  35.     private Collection $answers;
  36.     #[Groups('get')]
  37.     #[ORM\ManyToOne(targetEntityAnimal::class)]
  38.     #[ORM\JoinColumn(nullabletrue)]
  39.     private ?Animal $animal null;
  40.     #[Groups('get')]
  41.     #[ORM\Column(type'text'nullablefalse)]
  42.     private ?string $description null;
  43.     #[Groups('get')]
  44.     #[ORM\Column(type'boolean'nullabletrue)]
  45.     private ?bool $isAnimal null;
  46.     #[Groups('get')]
  47.     #[ORM\ManyToOne(targetEntityEntity::class, inversedBy'formAccesses')]
  48.     #[ORM\JoinColumn(nullabletrue)]
  49.     private mixed $entity;
  50.     #[Groups('get')]
  51.     #[ORM\ManyToMany(targetEntityProfile::class, inversedBy'formAccesses')]
  52.     private Collection $profiles;
  53.     #[Groups('get')]
  54.     #[ORM\Column(type'text'nullabletrue)]
  55.     private ?string $jsonForm null;
  56.     #[Groups('get')]
  57.     #[ORM\OneToMany(mappedBy'form'targetEntityField::class, cascade: ['persist'], orphanRemovaltrue)]
  58.     private Collection $fields;
  59.     #[Groups('get')]
  60.     #[ORM\Column(type'date')]
  61.     private \DateTime $publicationDate;
  62.     #[Groups('get')]
  63.     #[ORM\Column(type'boolean')]
  64.     private bool $isGeolocated false;
  65.     #[Groups('get')]
  66.     #[ORM\Column(type'boolean')]
  67.     private bool $isShape false;
  68.     #[Groups('get')]
  69.     #[ORM\Column(type'boolean'options: ['default' => true])]
  70.     private ?bool $isPublic true;
  71.     #[Groups('get')]
  72.     #[ORM\Column(type'boolean')]
  73.     private bool $gotMedia false;
  74.     #[Groups('get')]
  75.     #[ORM\Column(type'string'length255nullabletrue)]
  76.     private ?string $mediaExplanation null;
  77.     #[Groups('get')]
  78.     #[ORM\Column(type'boolean'nullabletrue)]
  79.     private ?bool $isBooking false;
  80.     #[Groups('get')]
  81.     #[ORM\Column(type'integer'nullabletrue)]
  82.     private ?int $numberBooking null;
  83.     #[Groups('get')]
  84.     #[ORM\Column(type'date'nullabletrue)]
  85.     private ?\DateTimeInterface $bookingDate null;
  86.     #[Groups('get')]
  87.     #[ORM\OneToOne(inversedBy'formPdf'targetEntityMedia::class, cascade: ['persist''remove'])]
  88.     private ?Media $pdf null;
  89.     #[Groups('get')]
  90.     #[ORM\OneToMany(mappedBy'form'targetEntityMedia::class, orphanRemovaltrue)]
  91.     private Collection $pictures;
  92.     #[ORM\ManyToOne(targetEntityCategory::class, inversedBy'forms')]
  93.     private ?Category $category null;
  94.     #[Groups('get')]
  95.     #[ORM\Column(type'boolean'nullabletrue)]
  96.     private ?bool $bookingNameDisplay null;
  97.     #[Groups('get')]
  98.     #[ORM\Column(type'boolean'options: ['default' => false])]
  99.     private ?bool $bookingSpace null;
  100.     #[Groups('get')]
  101.     #[ORM\Column(type'boolean'options: ['default' => false])]
  102.     private ?bool $isSigned;
  103.     #[ORM\Column]
  104.     #[Groups('get')]
  105.     private ?bool $isObject false;
  106.     #[ORM\Column]
  107.     #[Groups('get')]
  108.     private ?bool $isLinkedToObject false;
  109.     #[ORM\ManyToOne(cascade: ['persist','remove'], inversedBy'forms')]
  110.     #[ORM\JoinColumn(onDelete'SET NULL')]
  111.     private ?MapObjectType $mapObjectType null;
  112.     #[ORM\Column(nullabletrue)]
  113.     private ?bool $edit null;
  114.     #[ORM\Column(type'boolean'options: ['default' => false])]
  115.     #[Groups('get')]
  116.     private ?bool $isPolyline false;
  117.     #[ORM\Column(typeTypes::DATE_MUTABLEnullabletrue)]
  118.     private ?\DateTimeInterface $publicationEnd null;
  119.     public function __construct()
  120.     {
  121.         $this->answers = new ArrayCollection();
  122.         $this->profiles = new ArrayCollection();
  123.         $this->fields = new ArrayCollection();
  124.         $this->publicationDate = new \DateTime();
  125.         $this->pictures = new ArrayCollection();
  126.     }
  127.     public function getId() : ?int
  128.     {
  129.         return $this->id;
  130.     }
  131.     public function setId(?int $id) : Form
  132.     {
  133.         $this->id $id;
  134.         return $this;
  135.     }
  136.     public function getTitle() : ?string
  137.     {
  138.         return $this->title;
  139.     }
  140.     public function setTitle(string $title) : self
  141.     {
  142.         $this->title $title;
  143.         return $this;
  144.     }
  145.     public function getIsActive() : ?bool
  146.     {
  147.         return $this->isActive;
  148.     }
  149.     public function setIsActive(bool $isActive) : self
  150.     {
  151.         $this->isActive $isActive;
  152.         return $this;
  153.     }
  154.     /**
  155.      * @return Collection|Answer[]
  156.      */
  157.     public function getAnswers() : Collection
  158.     {
  159.         return $this->answers;
  160.     }
  161.     public function addAnswer(Answer $answer) : self
  162.     {
  163.         if (!$this->answers->contains($answer)) {
  164.             $this->answers[] = $answer;
  165.             $answer->setForm($this);
  166.         }
  167.         return $this;
  168.     }
  169.     public function removeAnswer(Answer $answer) : self
  170.     {
  171.         if ($this->answers->removeElement($answer)) {
  172.             // set the owning side to null (unless already changed)
  173.             if ($answer->getForm() === $this) {
  174.                 $answer->setForm(null);
  175.             }
  176.         }
  177.         return $this;
  178.     }
  179.     public function getAnimal() : ?Animal
  180.     {
  181.         return $this->animal;
  182.     }
  183.     public function setAnimal(?Animal $animal) : self
  184.     {
  185.         $this->animal $animal;
  186.         return $this;
  187.     }
  188.     public function getDescription() : ?string
  189.     {
  190.         return $this->description;
  191.     }
  192.     public function setDescription(?string $description) : self
  193.     {
  194.         $this->description $description;
  195.         return $this;
  196.     }
  197.     public function getIsAnimal() : ?bool
  198.     {
  199.         return $this->isAnimal;
  200.     }
  201.     public function setIsAnimal(?bool $isAnimal) : self
  202.     {
  203.         $this->isAnimal $isAnimal;
  204.         return $this;
  205.     }
  206.     /**
  207.      * @return mixed
  208.      */
  209.     public function getEntity() : ?Entity
  210.     {
  211.         return $this->entity;
  212.     }
  213.     public function setEntity(mixed $entity) : Form
  214.     {
  215.         $this->entity $entity;
  216.         return $this;
  217.     }
  218.     /**
  219.      * @return mixed
  220.      */
  221.     public function getProfiles() : Collection
  222.     {
  223.         return $this->profiles;
  224.     }
  225.     public function addProfile(Profile $profile) : self
  226.     {
  227.         if (!$this->profiles->contains($profile)) {
  228.             $this->profiles[] = $profile;
  229.             $profile->addForm($this);
  230.         }
  231.         return $this;
  232.     }
  233.     public function removeProfile(Profile $profile) : self
  234.     {
  235.         if ($this->profiles->removeElement($profile)) {
  236.             $profile->removeForm($this);
  237.         }
  238.         return $this;
  239.     }
  240.     public function removeAllProfiles() : self
  241.     {
  242.         foreach ($this->profiles as $profile) {
  243.             $profile->removeForm($this);
  244.         }
  245.         return $this;
  246.     }
  247.     public function getJsonForm() : ?string
  248.     {
  249.         return $this->jsonForm;
  250.     }
  251.     public function setJsonForm(?string $jsonForm) : self
  252.     {
  253.         $this->jsonForm $jsonForm;
  254.         return $this;
  255.     }
  256.     /**
  257.      * @return Collection|Field[]
  258.      */
  259.     public function getFields() : Collection
  260.     {
  261.         return $this->fields;
  262.     }
  263.     public function addField(Field $field) : self
  264.     {
  265.         if (!$this->fields->contains($field)) {
  266.             $this->fields[] = $field;
  267.             $field->setForm($this);
  268.         }
  269.         return $this;
  270.     }
  271.     public function removeField(Field $field) : self
  272.     {
  273.         if ($this->fields->removeElement($field)) {
  274.             // set the owning side to null (unless already changed)
  275.             if ($field->getForm() === $this) {
  276.                 $field->setForm(null);
  277.             }
  278.         }
  279.         return $this;
  280.     }
  281.     public function getPublicationDate() : ?\DateTimeInterface
  282.     {
  283.         return $this->publicationDate;
  284.     }
  285.     public function setPublicationDate(\DateTimeInterface $publicationDate) : self
  286.     {
  287.         $this->publicationDate $publicationDate;
  288.         return $this;
  289.     }
  290.     public function getIsGeolocated() : ?bool
  291.     {
  292.         return $this->isGeolocated;
  293.     }
  294.     public function setIsGeolocated(bool $isGeolocated) : self
  295.     {
  296.         $this->isGeolocated $isGeolocated;
  297.         return $this;
  298.     }
  299.     public function getIsShape() : ?bool
  300.     {
  301.         return $this->isShape;
  302.     }
  303.     public function setIsShape(bool $isShape) : self
  304.     {
  305.         $this->isShape $isShape;
  306.         return $this;
  307.     }
  308.     public function __toString() : string
  309.     {
  310.         return (string) $this->id;
  311.     }
  312.     public function getIsPublic() : ?bool
  313.     {
  314.         return $this->isPublic;
  315.     }
  316.     public function setIsPublic(bool $isPublic) : self
  317.     {
  318.         $this->isPublic $isPublic;
  319.         return $this;
  320.     }
  321.     public function getGotMedia() : ?bool
  322.     {
  323.         return $this->gotMedia;
  324.     }
  325.     public function setGotMedia(bool $gotMedia) : self
  326.     {
  327.         $this->gotMedia $gotMedia;
  328.         return $this;
  329.     }
  330.     public function getMediaExplanation() : ?string
  331.     {
  332.         return $this->mediaExplanation;
  333.     }
  334.     public function setMediaExplanation(?string $mediaExplanation) : self
  335.     {
  336.         $this->mediaExplanation $mediaExplanation;
  337.         return $this;
  338.     }
  339.     public function getIsBooking() : ?bool
  340.     {
  341.         return $this->isBooking;
  342.     }
  343.     public function setIsBooking(?bool $isBooking) : self
  344.     {
  345.         $this->isBooking $isBooking;
  346.         return $this;
  347.     }
  348.     public function getNumberBooking() : ?int
  349.     {
  350.         return $this->numberBooking;
  351.     }
  352.     public function setNumberBooking(?int $numberBooking) : self
  353.     {
  354.         $this->numberBooking $numberBooking;
  355.         return $this;
  356.     }
  357.     public function getBookingDate() : ?\DateTimeInterface
  358.     {
  359.         return $this->bookingDate;
  360.     }
  361.     public function setBookingDate(?\DateTimeInterface $bookingDate) : self
  362.     {
  363.         $this->bookingDate $bookingDate;
  364.         return $this;
  365.     }
  366.     public function getCategory() : ?Category
  367.     {
  368.         return $this->category;
  369.     }
  370.     public function setCategory(?Category $category) : self
  371.     {
  372.         $this->category $category;
  373.         return $this;
  374.     }
  375.     public function getPdf() : ?Media
  376.     {
  377.         return $this->pdf;
  378.     }
  379.     public function setPdf(?Media $pdf) : self
  380.     {
  381.         $this->pdf $pdf;
  382.         return $this;
  383.     }
  384.     /**
  385.      * @return Collection|Media[]
  386.      */
  387.     public function getPictures() : Collection
  388.     {
  389.         return $this->pictures;
  390.     }
  391.     public function addPicture(Media $picture) : self
  392.     {
  393.         if (!$this->pictures->contains($picture)) {
  394.             $this->pictures[] = $picture;
  395.             $picture->setForm($this);
  396.         }
  397.         return $this;
  398.     }
  399.     public function removePicture(Media $picture) : self
  400.     {
  401.         if ($this->pictures->removeElement($picture)) {
  402.             // set the owning side to null (unless already changed)
  403.             if ($picture->getForm() === $this) {
  404.                 $picture->setForm(null);
  405.             }
  406.         }
  407.         return $this;
  408.     }
  409.     public function getBookingNameDisplay() : ?bool
  410.     {
  411.         return $this->bookingNameDisplay;
  412.     }
  413.     public function setBookingNameDisplay(?bool $bookingNameDisplay) : self
  414.     {
  415.         $this->bookingNameDisplay $bookingNameDisplay;
  416.         return $this;
  417.     }
  418.     public function getBookingSpace() : ?bool
  419.     {
  420.         return $this->bookingSpace;
  421.     }
  422.     public function setBookingSpace(bool $bookingSpace) : self
  423.     {
  424.         $this->bookingSpace $bookingSpace;
  425.         return $this;
  426.     }
  427.     public function getIsSigned(): ?bool
  428.     {
  429.         return $this->isSigned;
  430.     }
  431.     public function setIsSigned(bool $isSigned): self
  432.     {
  433.         $this->isSigned $isSigned;
  434.         return $this;
  435.     }
  436.     public function getIsObject(): ?bool
  437.     {
  438.         return $this->isObject;
  439.     }
  440.     public function setIsObject(bool $isObject): self
  441.     {
  442.         $this->isObject $isObject;
  443.         return $this;
  444.     }
  445.     public function getMapObjectType(): ?MapObjectType
  446.     {
  447.         return $this->mapObjectType;
  448.     }
  449.     public function setMapObjectType(?MapObjectType $mapObjectType): self
  450.     {
  451.         $this->mapObjectType $mapObjectType;
  452.         return $this;
  453.     }
  454.     public function getIsLinkedToObject(): ?bool
  455.     {
  456.         return $this->isLinkedToObject;
  457.     }
  458.     public function setIsLinkedToObject(?bool $isLinkedToObject): self
  459.     {
  460.         $this->isLinkedToObject $isLinkedToObject;
  461.         return $this;
  462.     }
  463.     public function isEdit(): ?bool
  464.     {
  465.         return $this->edit;
  466.     }
  467.     public function setEdit(?bool $edit): self
  468.     {
  469.         $this->edit $edit;
  470.         return $this;
  471.     }
  472.     public function getIsPolyline(): ?bool
  473.     {
  474.         return $this->isPolyline;
  475.     }
  476.     public function setIsPolyline(?bool $isPolyline): self
  477.     {
  478.         $this->isPolyline $isPolyline;
  479.         return $this;
  480.     }
  481.     public function getPublicationEnd(): ?\DateTimeInterface
  482.     {
  483.         return $this->publicationEnd;
  484.     }
  485.     public function setPublicationEnd(?\DateTimeInterface $publicationEnd): self
  486.     {
  487.         $this->publicationEnd $publicationEnd;
  488.         return $this;
  489.     }
  490. }