<?php
namespace App\Entity;
use ApiPlatform\Metadata\ApiResource;
use App\Repository\ActionPlanCommentRepository;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;
use App\Traits\AutoTimestampTrait;
#[ORM\Entity(repositoryClass: ActionPlanCommentRepository::class)]
#[ApiResource(
normalizationContext: ['groups' => ['comment.get']],
denormalizationContext: ['groups' => ['comment.write']],
)]
#[ORM\HasLifecycleCallbacks]
class ActionPlanComment
{
use AutoTimestampTrait;
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
#[Groups(['comment.get', 'plan.get'])]
private ?int $id = null;
#[ORM\Column(type: Types::TEXT)]
#[Groups(['comment.write', 'comment.get', 'plan.get'])]
private ?string $comment = null;
#[ORM\ManyToOne]
#[Groups(['comment.write', 'comment.get', 'plan.get'])]
private ?User $createdBy = null;
#[ORM\ManyToOne]
#[Groups(['comment.write', 'comment.get', 'plan.get'])]
private ?User $updatedBy = null;
#[ORM\ManyToOne(inversedBy: 'actionPlanComments')]
#[ORM\JoinColumn(nullable: false)]
#[Groups(['comment.write'])]
private ?ActionPlan $actionPlan = null;
public function getId(): ?int
{
return $this->id;
}
public function getComment(): ?string
{
return $this->comment;
}
public function setComment(string $comment): self
{
$this->comment = $comment;
return $this;
}
public function getCreatedBy(): ?User
{
return $this->createdBy;
}
public function setCreatedBy(?User $createdBy): self
{
$this->createdBy = $createdBy;
return $this;
}
public function getUpdatedBy(): ?User
{
return $this->updatedBy;
}
public function setUpdatedBy(?User $updatedBy): self
{
$this->updatedBy = $updatedBy;
return $this;
}
public function getActionPlan(): ?ActionPlan
{
return $this->actionPlan;
}
public function setActionPlan(?ActionPlan $actionPlan): self
{
$this->actionPlan = $actionPlan;
return $this;
}
// public function getUpdatedAt(): ?\DateTimeInterface
// {
// return $this->updatedAt;
// }
// public function setUpdatedAt(?\DateTimeInterface $updatedAt): self
// {
// $this->updatedAt = $updatedAt;
//
// return $this;
// }
//
// public function getCreatedAt(): ?\DateTimeInterface
// {
// return $this->createdAt;
// }
// public function setCreatedAt(?\DateTimeInterface $createdAt): self
// {
// $this->createdAt = $createdAt;
//
// return $this;
// }
}