<?php
namespace App\Entity\Scholar\PracticalCase;
use App\Entity\Channel\LockByInterface;
use App\Repository\Scholar\SharedPracticalCaseRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Nellapp\Bundle\SDKBundle\Channel\Entity\ChannelInterface;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
#[ORM\Table(name: 'scholar_shared_practical_cases')]
#[ORM\Entity(repositoryClass: SharedPracticalCaseRepository::class)]
#[UniqueEntity(
fields: ['lockBy', 'lesson'],
)]
class SharedPracticalCase extends PracticalCase implements LockByInterface
{
#[ORM\ManyToOne(targetEntity: OriginPracticalCase::class, fetch: 'EAGER', inversedBy: 'sharedPracticalCases')]
#[ORM\JoinColumn(nullable: false, onDelete: 'CASCADE')]
private ?OriginPracticalCase $lockBy = null;
public function getTitle(): ?string
{
return $this->lockBy?->getTitle();
}
public function getContent(): ?string
{
return $this->lockBy?->getContent();
}
public function getRemark(): ?string
{
return $this->lockBy?->getRemark();
}
public function getEstimateTime(): ?int
{
return $this->lockBy?->getEstimateTime();
}
public function getCorrection(): ?string
{
return $this->lockBy?->getCorrection();
}
public function getIsArchived(): ?bool
{
return $this->lockBy?->getIsArchived();
}
public function getPracticalCaseResources(): Collection
{
return $this->lockBy?->getPracticalCaseResources() ?? new ArrayCollection();
}
public function getLockBy(): ?PracticalCase
{
return $this->lockBy;
}
public function setLockBy(?PracticalCase $lockBy): PracticalCase
{
$this->lockBy = $lockBy;
return $this;
}
public function getLockByOwnerChannel(): ?ChannelInterface
{
return $this->getLockBy()?->getLesson()->getOwnerChannel();
}
public function getLockByStatus(): ?bool
{
return null;
}
public function setLockByStatus(?bool $status): static
{
return $this;
}
}