src/Entity/MoodAfterPostResponse.php line 45

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use ApiPlatform\Core\Annotation\ApiFilter;
  4. use ApiPlatform\Core\Annotation\ApiResource;
  5. use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\DateFilter;
  6. use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\OrderFilter;
  7. use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\SearchFilter;
  8. use ApiPlatform\Core\Serializer\Filter\GroupFilter;
  9. use App\Repository\MoodAfterPostResponseRepository;
  10. use Doctrine\ORM\Mapping as ORM;
  11. use Symfony\Component\Serializer\Annotation\Groups;
  12. use Symfony\Component\Validator\Constraints as Assert;
  13. /**
  14.  * @ORM\Entity(repositoryClass=MoodAfterPostResponseRepository::class)
  15.  * @ApiResource(
  16.  *      normalizationContext={"groups"={"mood_after_post_response:read"}},
  17.  *      denormalizationContext={"groups"={"mood_after_post_response:write"}},
  18.  *      itemOperations={
  19.  *          "get"={"security"="is_granted('ROLE_USER')"},
  20.  *          "patch"={"security"="is_granted('ROLE_ADMIN')"},
  21.  *          "custom_patch_mood_after_post_response"={
  22.  *                  "method"="PATCH",
  23.  *                  "security"="is_granted('ROLE_ADMIN')",
  24.  *                  "path"="/custom/mood_after_post_responses/{id}",
  25.  *                  "controller"="App\Controller\Api\MoodAfterPostResponsesController::customPatchMoodAfterPostResponses",
  26.  *                  "input_formats"={"json"={"application/merge-patch+json"}}
  27.  *          },
  28.  *          "delete"={"security"="is_granted('ROLE_ADMIN')"}
  29.  *      },
  30.  *      collectionOperations={
  31.  *          "get"={"security"="is_granted('ROLE_USER')"},
  32.  *          "post"={"security"="is_granted('ROLE_USER')"}
  33.  *      }
  34.  * )
  35.  * @ApiFilter(OrderFilter::class)
  36.  * @ApiFilter(SearchFilter::class, properties={"name":"partial"})
  37.  * @ApiFilter(DateFilter::class)
  38.  * @ApiFilter(GroupFilter::class, arguments={"parameterName": "groups", "overrideDefaultGroups": true, "whitelist": {
  39.  *      "moods_form"
  40.  * }})
  41.  */
  42. class MoodAfterPostResponse
  43. {
  44.     /**
  45.      * @ORM\Id
  46.      * @ORM\GeneratedValue
  47.      * @ORM\Column(type="integer")
  48.      * @Groups({"mood_after_post_response:read", "moods_form", "program_edit"})
  49.      */
  50.     private $id;
  51.     /**
  52.      * @ORM\Column(type="string", length=255, nullable=true)
  53.      * @Groups({"mood_after_post_response:read", "mood_after_post_response:write", "moods_form", "video_form_complete",
  54.      *     "program_edit"})
  55.      */
  56.     private $name;
  57.     /**
  58.      * @ORM\Column(type="string", length=510, nullable=true)
  59.      * @Groups({"mood_after_post_response:read", "mood_after_post_response:write"})
  60.      * @Assert\NotNull(message="mood_after_post_response.description")
  61.      */
  62.     private $description;
  63.     /**
  64.      * @ORM\Column(type="integer", nullable=true)
  65.      * @Groups({"mood_after_post_response:read", "mood_after_post_response:write"})
  66.      */
  67.     private $moodId;
  68.     /**
  69.      * @ORM\Column(type="string", length=255, nullable=true)
  70.      * @Groups({"mood_after_post_response:read", "mood_after_post_response:write"})
  71.      */
  72.     private $moodImg;
  73.     /**
  74.      * @ORM\Column(type="string", length=255, nullable=true)
  75.      * @Groups({"mood_after_post_response:read", "mood_after_post_response:write"})
  76.      */
  77.     private $moodName;
  78.     /**
  79.      * @ORM\Column(type="integer", nullable=true)
  80.      * @Groups({"mood_after_post_response:read", "mood_after_post_response:write"})
  81.      */
  82.     private $answerId;
  83.     /**
  84.      * @ORM\Column(type="string", length=255, nullable=true)
  85.      * @Groups({"mood_after_post_response:read", "mood_after_post_response:write"})
  86.      */
  87.     private $answerName;
  88.     /**
  89.      * @ORM\Column(type="datetime")
  90.      * @Groups({"mood_after_post_response:read"})
  91.      */
  92.     private $createdAt;
  93.     /**
  94.      * @var array
  95.      * @Groups({"mood_after_post_response:read", "mood_after_post_response:write"})
  96.      */
  97.     public $videos;
  98.     /**
  99.      * @var array
  100.      * @Groups({"mood_after_post_response:read", "mood_after_post_response:write"})
  101.      */
  102.     public $programs;
  103.     /**
  104.      * @var array
  105.      * @Groups({"mood_after_post_response:read", "mood_after_post_response:write"})
  106.      */
  107.     public $channels;
  108.     /**
  109.      * @ORM\Column(type="boolean", options={"default": "1"})
  110.      * @Groups({"mood_after_post_response:read", "mood_after_post_response:write"})
  111.      */
  112.     private $active true;
  113.     public function __construct()
  114.     {
  115.         $this->createdAt = new \DateTime();
  116.         $this->active true;
  117.         $this->description "";
  118.     }
  119.     public function getId(): ?int
  120.     {
  121.         return $this->id;
  122.     }
  123.     public function getName(): ?string
  124.     {
  125.         return $this->name;
  126.     }
  127.     public function setName(?string $name): self
  128.     {
  129.         $this->name $name;
  130.         return $this;
  131.     }
  132.     public function getDescription(): ?string
  133.     {
  134.         return $this->description;
  135.     }
  136.     public function setDescription(?string $description): self
  137.     {
  138.         $this->description $description;
  139.         return $this;
  140.     }
  141.     public function getMoodId(): ?int
  142.     {
  143.         return $this->moodId;
  144.     }
  145.     public function setMoodId(?int $moodId): self
  146.     {
  147.         $this->moodId $moodId;
  148.         return $this;
  149.     }
  150.     public function getMoodImg(): ?string
  151.     {
  152.         return $this->moodImg;
  153.     }
  154.     public function setMoodImg(?string $moodImg): self
  155.     {
  156.         $this->moodImg $moodImg;
  157.         return $this;
  158.     }
  159.     public function getMoodName(): ?string
  160.     {
  161.         return $this->moodName;
  162.     }
  163.     public function setMoodName(?string $moodName): self
  164.     {
  165.         $this->moodName $moodName;
  166.         return $this;
  167.     }
  168.     public function getAnswerId(): ?int
  169.     {
  170.         return $this->answerId;
  171.     }
  172.     public function setAnswerId(?int $answerId): self
  173.     {
  174.         $this->answerId $answerId;
  175.         return $this;
  176.     }
  177.     public function getAnswerName(): ?string
  178.     {
  179.         return $this->answerName;
  180.     }
  181.     public function setAnswerName(?string $answerName): self
  182.     {
  183.         $this->answerName $answerName;
  184.         return $this;
  185.     }
  186.     public function getCreatedAt(): ?\DateTimeInterface
  187.     {
  188.         return $this->createdAt;
  189.     }
  190.     public function setCreatedAt(\DateTimeInterface $createdAt): self
  191.     {
  192.         $this->createdAt $createdAt;
  193.         return $this;
  194.     }
  195.     public function getActive(): ?bool
  196.     {
  197.         return $this->active;
  198.     }
  199.     public function setActive(bool $active): self
  200.     {
  201.         $this->active $active;
  202.         return $this;
  203.     }
  204. }