src/Entity/Saloon/MediaFile.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Saloon;
  3. use App\Entity\IMediaFile;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Doctrine\ORM\Mapping\Index;
  6. #[ORM\Table(name'saloon_media_files')]
  7. #[Index(name'idx_type'columns: ['type'])]
  8. #[Index(name'idx_saloon_type'columns: ['saloon_id''type'])]
  9. #[ORM\Entity]
  10. #[ORM\InheritanceType('SINGLE_TABLE')]
  11. #[ORM\DiscriminatorColumn(name'type'type'string'length12)]
  12. #[ORM\DiscriminatorMap(['photo' => Photo::class, 'thumbnail' => Thumbnail::class, 'video' => Video::class])]
  13. abstract class MediaFile implements IMediaFile
  14. {
  15.     #[ORM\Id]
  16.     #[ORM\Column(name'id'type'integer')]
  17.     #[ORM\GeneratedValue(strategy'AUTO')]
  18.     protected int $id;
  19.     #[ORM\JoinColumn(name'saloon_id'referencedColumnName'id')]
  20.     #[ORM\ManyToOne(targetEntitySaloon::class)]
  21.     protected Saloon $saloon;
  22.     #[ORM\Column(name'path'type'string'length128)]
  23.     protected string $path;
  24.     #[ORM\Column(name'preview_path'type'string'length128nullabletrue)]
  25.     protected ?string $previewPath null;
  26.     public function __construct(Saloon $saloonstring $path)
  27.     {
  28.         $this->saloon $saloon;
  29.         $this->path $path;
  30.     }
  31.     public function getId(): int
  32.     {
  33.         return $this->id;
  34.     }
  35.     public function getPath(): string
  36.     {
  37.         return $this->path;
  38.     }
  39.     public function setPath(string $path): void
  40.     {
  41.         $this->path $path;
  42.     }
  43.     public function getPreviewPath(): ?string
  44.     {
  45.         return $this->previewPath;
  46.     }
  47.     public function setPreviewPath(?string $previewPath): void
  48.     {
  49.         $this->previewPath $previewPath;
  50.     }
  51. }