<?php
namespace App\Entity\Scholar\PracticalCase;
use App\Entity\Account\User;
use App\Entity\Common\Assignable;
use App\Repository\Scholar\PracticalCase\PracticalCaseResponseRepository;
use App\Validator\Constraints\PracticalCaseResponseConstraint;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
#[
ORM\Entity(repositoryClass: PracticalCaseResponseRepository::class),
PracticalCaseResponseConstraint(),
]
class PracticalCaseResponse extends Assignable
{
#[ORM\ManyToOne(targetEntity: PracticalCaseUser::class, inversedBy: 'practicalCaseResponses')]
#[ORM\JoinColumn(nullable: false, onDelete: 'CASCADE')]
private PracticalCaseUser $practicalCaseUser;
#[ORM\Column(type: 'text', nullable: false)]
#[Assert\NotBlank]
private ?string $content;
#[ORM\Column(type: 'text', nullable: true)]
private ?string $correction;
#[ORM\OneToOne(targetEntity: FilePracticalCaseResponse::class, cascade: ['persist', 'remove'], fetch: "EAGER")]
#[ORM\JoinColumn(nullable: true)]
private ?FilePracticalCaseResponse $file = null;
#[ORM\Column(type: 'integer', nullable: false)]
private int $status;
#[ORM\ManyToOne(targetEntity: User::class)]
#[ORM\JoinColumn(nullable: true, onDelete: 'SET NULL')]
private ?User $correctedBy = null;
#[ORM\Column(type: 'datetime', nullable: true)]
private ?\DateTime $correctedAt;
public function getCorrection(): ?string
{
return $this->correction;
}
public function setCorrection(?string $correction): self
{
$this->correction = $correction;
return $this;
}
public function getCorrectedBy(): ?User
{
return $this->correctedBy;
}
public function setCorrectedBy(?User $correctedBy): self
{
$this->correctedBy = $correctedBy;
return $this;
}
public function getFile(): ?FilePracticalCaseResponse
{
return $this->file;
}
public function setFile(?FilePracticalCaseResponse $file): self
{
$this->file = $file;
return $this;
}
public function getPracticalCaseUser(): PracticalCaseUser
{
return $this->practicalCaseUser;
}
public function setPracticalCaseUser(PracticalCaseUser $practicalCaseUser): PracticalCaseResponse
{
$this->practicalCaseUser = $practicalCaseUser;
return $this;
}
public function getContent(): ?string
{
return $this->content;
}
public function setContent(?string $content): PracticalCaseResponse
{
$this->content = $content;
return $this;
}
public function getStatus(): int
{
return $this->status;
}
public function setStatus(int $status): PracticalCaseResponse
{
$this->status = $status;
return $this;
}
public function getCorrectedAt(): ?\DateTime
{
return $this->correctedAt;
}
public function setCorrectedAt(?\DateTime $correctedAt): PracticalCaseResponse
{
$this->correctedAt = $correctedAt;
return $this;
}
}