src/Entity/PinpointCampaignQuestion.php line 28

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use ApiPlatform\Core\Annotation\ApiResource;
  4. use DateTime;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Symfony\Component\Serializer\Annotation\Groups;
  7. use Symfony\Component\Validator\Constraints as Assert;
  8. /**
  9.  * @ORM\Entity(repositoryClass="App\Repository\PinpointCampaignQuestionRepository")
  10.  * @ORM\HasLifecycleCallbacks()
  11.  */
  12. #[ApiResource(
  13.     attributes: ['security' => "is_granted('ROLE_USER')"],
  14.     normalizationContext: ['groups' => ['pinpointCampaignQuestion:read']],
  15.     denormalizationContext: ['groups' => ['pinpointCampaignQuestion:write']],
  16.     collectionOperations: [
  17.         'get',
  18.         'post' => ['security' => "is_granted('ROLE_ADMIN')"],
  19.     ],
  20.     itemOperations: [
  21.         'get',
  22.         'put' => ['security' => "is_granted('ROLE_ADMIN') or object.owner == user"],
  23.     ],
  24. )]
  25. class PinpointCampaignQuestion
  26. {
  27.     /**
  28.      * @ORM\Id()
  29.      * @ORM\GeneratedValue()
  30.      * @ORM\Column(type="integer")
  31.      */
  32.     private $id;
  33.     /**
  34.      * @var SurveyFormQuestion
  35.      *
  36.      * @ORM\ManyToOne(targetEntity="App\Entity\SurveyFormQuestion")
  37.      * @ORM\JoinColumn(nullable=false, onDelete="CASCADE")
  38.      * @Assert\NotNull()
  39.      * @Groups({"pinpointCampaignQuestion:read", "pinpointCampaignQuestion:write"})
  40.      */
  41.     private $formQuestion;
  42.     /**
  43.      * @var string
  44.      *
  45.      * @ORM\Column(type="string", length=256, nullable=true)
  46.      */
  47.     private $answerId;
  48.     /**
  49.      * @ORM\Column(type="boolean")
  50.      * @Assert\Type("bool")
  51.      */
  52.     private $isSkipped;
  53.     /**
  54.      * @ORM\Column(type="boolean", nullable=true)
  55.      * @Assert\Type("bool")
  56.      * @Groups({"pinpointCampaignQuestion:read", "pinpointCampaignQuestion:write"})
  57.      */
  58.     private $isDraft;
  59.     /**
  60.      * @var DateTime
  61.      *
  62.      * @ORM\Column(type="datetime", nullable=false)
  63.      * @Groups({"pinpointCampaignQuestion:read", "pinpointCampaignQuestion:write"})
  64.      */
  65.     private $startTime;
  66.     /**
  67.      * @var DateTime
  68.      *
  69.      * @ORM\Column(type="datetime", nullable=true)
  70.      * @Groups({"pinpointCampaignQuestion:read", "pinpointCampaignQuestion:write"})
  71.      */
  72.     private $endTime;
  73.     /**
  74.      * @ORM\ManyToOne(targetEntity=User::class, inversedBy="pinpointCampaignQuestions")
  75.      * @Groups({"pinpointCampaignQuestion:read", "pinpointCampaignQuestion:write"})
  76.      */
  77.     private $user;
  78.     /**
  79.      * @ORM\ManyToOne(targetEntity=PinpointCampaign::class, inversedBy="pinpointCampaignQuestions")
  80.      * @ORM\JoinColumn(nullable=false)
  81.      */
  82.     private $pinpointCampaign;
  83.     /**
  84.      * Company constructor.
  85.      */
  86.     public function __construct()
  87.     {
  88.         $this->isSkipped 0;
  89.         $this->endTime null;
  90.         $this->startTime null;
  91.     }
  92.     public function getId(): ?int
  93.     {
  94.         return $this->id;
  95.     }
  96.     public function getFormQuestion(): ?SurveyFormQuestion
  97.     {
  98.         return $this->formQuestion;
  99.     }
  100.     public function setFormQuestion(?SurveyFormQuestion $formQuestion): self
  101.     {
  102.         $this->formQuestion $formQuestion;
  103.         return $this;
  104.     }
  105.     public function getAnswerId(): ?string
  106.     {
  107.         return $this->answerId;
  108.     }
  109.     public function setAnswerId(string $answerId): self
  110.     {
  111.         $this->answerId $answerId;
  112.         return $this;
  113.     }
  114.     public function getIsSkipped(): bool
  115.     {
  116.         return $this->isSkipped;
  117.     }
  118.     public function setIsSkipped(bool $isSkipped): self
  119.     {
  120.         $this->isSkipped $isSkipped;
  121.         return $this;
  122.     }
  123.     public function getIsDraft(): ?bool
  124.     {
  125.         return $this->isDraft;
  126.     }
  127.     public function setIsDraft(?bool $isDraft): self
  128.     {
  129.         $this->isDraft $isDraft;
  130.         return $this;
  131.     }
  132.     public function getStartTime(): ?DateTime
  133.     {
  134.         return $this->startTime;
  135.     }
  136.     public function setStartTime(?DateTime $startTime): self
  137.     {
  138.         $this->startTime $startTime;
  139.         return $this;
  140.     }
  141.     public function getEndTime(): ?DateTime
  142.     {
  143.         return $this->endTime;
  144.     }
  145.     public function setEndTime(?DateTime $endTime): self
  146.     {
  147.         $this->endTime $endTime;
  148.         return $this;
  149.     }
  150.     public function getUser(): ?User
  151.     {
  152.         return $this->user;
  153.     }
  154.     public function setUser(?User $user): self
  155.     {
  156.         $this->user $user;
  157.         return $this;
  158.     }
  159.     public function getPinpointCampaign(): ?PinpointCampaign
  160.     {
  161.         return $this->pinpointCampaign;
  162.     }
  163.     public function setPinpointCampaign(?PinpointCampaign $pinpointCampaign): self
  164.     {
  165.         $this->pinpointCampaign $pinpointCampaign;
  166.         return $this;
  167.     }
  168. }