<?php
namespace App\Entity\Profile\Confirmation;
use App\Entity\IMediaFile;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Table(name: 'profile_confirmation_requests_media_files')]
#[ORM\Entity]
#[ORM\InheritanceType('SINGLE_TABLE')]
#[ORM\DiscriminatorColumn(name: 'type', type: 'string', length: 12)]
#[ORM\DiscriminatorMap(['photo' => Photo::class, 'video' => Video::class])]
abstract class MediaFile implements IMediaFile
{
#[ORM\Id]
#[ORM\Column(name: 'id', type: 'integer')]
#[ORM\GeneratedValue(strategy: 'AUTO')]
protected int $id;
#[ORM\JoinColumn(name: 'confirmation_request_id', referencedColumnName: 'id')]
#[ORM\ManyToOne(targetEntity: ConfirmationRequest::class, inversedBy: 'photos')]
protected ConfirmationRequest $confirmationRequest;
#[ORM\Column(name: 'path', type: 'string', length: 128)]
protected string $path;
#[ORM\Column(name: 'preview_path', type: 'string', length: 128, nullable: true)]
protected ?string $previewPath = null;
public function __construct(ConfirmationRequest $confirmationRequest, string $path)
{
$this->confirmationRequest = $confirmationRequest;
$this->path = $path;
}
public function getId(): int
{
return $this->id;
}
public function getPath(): string
{
return $this->path;
}
public function setPath(string $path): void
{
$this->path = $path;
}
public function getPreviewPath(): ?string
{
return $this->previewPath;
}
public function setPreviewPath(?string $previewPath): void
{
$this->previewPath = $previewPath;
}
}