<?php
namespace App\Entity;
use ApiPlatform\Core\Annotation\ApiFilter;
use ApiPlatform\Core\Annotation\ApiResource;
use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\DateFilter;
use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\OrderFilter;
use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\SearchFilter;
use ApiPlatform\Core\Serializer\Filter\GroupFilter;
use App\Repository\MoodAfterPostResponseRepository;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity(repositoryClass=MoodAfterPostResponseRepository::class)
* @ApiResource(
* normalizationContext={"groups"={"mood_after_post_response:read"}},
* denormalizationContext={"groups"={"mood_after_post_response:write"}},
* itemOperations={
* "get"={"security"="is_granted('ROLE_USER')"},
* "patch"={"security"="is_granted('ROLE_ADMIN')"},
* "custom_patch_mood_after_post_response"={
* "method"="PATCH",
* "security"="is_granted('ROLE_ADMIN')",
* "path"="/custom/mood_after_post_responses/{id}",
* "controller"="App\Controller\Api\MoodAfterPostResponsesController::customPatchMoodAfterPostResponses",
* "input_formats"={"json"={"application/merge-patch+json"}}
* },
* "delete"={"security"="is_granted('ROLE_ADMIN')"}
* },
* collectionOperations={
* "get"={"security"="is_granted('ROLE_USER')"},
* "post"={"security"="is_granted('ROLE_USER')"}
* }
* )
* @ApiFilter(OrderFilter::class)
* @ApiFilter(SearchFilter::class, properties={"name":"partial"})
* @ApiFilter(DateFilter::class)
* @ApiFilter(GroupFilter::class, arguments={"parameterName": "groups", "overrideDefaultGroups": true, "whitelist": {
* "moods_form"
* }})
*/
class MoodAfterPostResponse
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
* @Groups({"mood_after_post_response:read", "moods_form", "program_edit"})
*/
private $id;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @Groups({"mood_after_post_response:read", "mood_after_post_response:write", "moods_form", "video_form_complete",
* "program_edit"})
*/
private $name;
/**
* @ORM\Column(type="string", length=510, nullable=true)
* @Groups({"mood_after_post_response:read", "mood_after_post_response:write"})
* @Assert\NotNull(message="mood_after_post_response.description")
*/
private $description;
/**
* @ORM\Column(type="integer", nullable=true)
* @Groups({"mood_after_post_response:read", "mood_after_post_response:write"})
*/
private $moodId;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @Groups({"mood_after_post_response:read", "mood_after_post_response:write"})
*/
private $moodImg;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @Groups({"mood_after_post_response:read", "mood_after_post_response:write"})
*/
private $moodName;
/**
* @ORM\Column(type="integer", nullable=true)
* @Groups({"mood_after_post_response:read", "mood_after_post_response:write"})
*/
private $answerId;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @Groups({"mood_after_post_response:read", "mood_after_post_response:write"})
*/
private $answerName;
/**
* @ORM\Column(type="datetime")
* @Groups({"mood_after_post_response:read"})
*/
private $createdAt;
/**
* @var array
* @Groups({"mood_after_post_response:read", "mood_after_post_response:write"})
*/
public $videos;
/**
* @var array
* @Groups({"mood_after_post_response:read", "mood_after_post_response:write"})
*/
public $programs;
/**
* @var array
* @Groups({"mood_after_post_response:read", "mood_after_post_response:write"})
*/
public $channels;
/**
* @ORM\Column(type="boolean", options={"default": "1"})
* @Groups({"mood_after_post_response:read", "mood_after_post_response:write"})
*/
private $active = true;
public function __construct()
{
$this->createdAt = new \DateTime();
$this->active = true;
$this->description = "";
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(?string $name): self
{
$this->name = $name;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
public function getMoodId(): ?int
{
return $this->moodId;
}
public function setMoodId(?int $moodId): self
{
$this->moodId = $moodId;
return $this;
}
public function getMoodImg(): ?string
{
return $this->moodImg;
}
public function setMoodImg(?string $moodImg): self
{
$this->moodImg = $moodImg;
return $this;
}
public function getMoodName(): ?string
{
return $this->moodName;
}
public function setMoodName(?string $moodName): self
{
$this->moodName = $moodName;
return $this;
}
public function getAnswerId(): ?int
{
return $this->answerId;
}
public function setAnswerId(?int $answerId): self
{
$this->answerId = $answerId;
return $this;
}
public function getAnswerName(): ?string
{
return $this->answerName;
}
public function setAnswerName(?string $answerName): self
{
$this->answerName = $answerName;
return $this;
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->createdAt;
}
public function setCreatedAt(\DateTimeInterface $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
public function getActive(): ?bool
{
return $this->active;
}
public function setActive(bool $active): self
{
$this->active = $active;
return $this;
}
}