src/Entity/MediaItem.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\MediaItemRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. /**
  6.  * @ORM\Entity(repositoryClass=MediaItemRepository::class)
  7.  * @ORM\Table(name="media_item")
  8.  */
  9. class MediaItem
  10. {
  11.     /**
  12.      * @ORM\Id
  13.      * @ORM\GeneratedValue
  14.      * @ORM\Column(type="integer")
  15.      */
  16.     private $id;
  17.     /**
  18.      * @ORM\ManyToOne(targetEntity=Instance::class)
  19.      * @ORM\JoinColumn(nullable=false, onDelete="CASCADE")
  20.      */
  21.     private $instance;
  22.     /**
  23.      * @ORM\ManyToOne(targetEntity=InstanceView::class)
  24.      * @ORM\JoinColumn(nullable=true, onDelete="SET NULL")
  25.      */
  26.     private $view;
  27.     /**
  28.      * @ORM\Column(name="row_pos", type="integer", options={"default" = 1})
  29.      */
  30.     private $row 1;
  31.     /**
  32.      * @ORM\Column(type="string", length=20)
  33.      */
  34.     private $type;
  35.     /**
  36.      * @ORM\Column(type="string", length=255)
  37.      */
  38.     private $originalFilename;
  39.     /**
  40.      * @ORM\Column(type="string", length=255)
  41.      */
  42.     private $originalPath;
  43.     /**
  44.      * @ORM\Column(type="json", nullable=true)
  45.      */
  46.     private $variants = [];
  47.     /**
  48.      * @ORM\Column(type="string", length=50)
  49.      */
  50.     private $status;
  51.     /**
  52.      * @ORM\Column(type="string", length=50)
  53.      */
  54.     private $sourceType;
  55.     /**
  56.      * @ORM\Column(type="json", nullable=true)
  57.      */
  58.     private $sourceConfig null;
  59.     /**
  60.      * @ORM\Column(type="datetime_immutable")
  61.      */
  62.     private $createdAt;
  63.     /**
  64.      * @ORM\Column(type="datetime_immutable")
  65.      */
  66.     private $updatedAt;
  67.     public function __construct()
  68.     {
  69.         $now = new \DateTimeImmutable();
  70.         $this->createdAt $now;
  71.         $this->updatedAt $now;
  72.         $this->status 'pending_download';
  73.         $this->variants = [];
  74.     }
  75.     public function getId(): ?int
  76.     {
  77.         return $this->id;
  78.     }
  79.     public function getInstance(): ?Instance
  80.     {
  81.         return $this->instance;
  82.     }
  83.     public function setInstance(Instance $instance): self
  84.     {
  85.         $this->instance $instance;
  86.         return $this;
  87.     }
  88.     public function getView(): ?InstanceView
  89.     {
  90.         return $this->view;
  91.     }
  92.     public function setView(?InstanceView $view): self
  93.     {
  94.         $this->view $view;
  95.         return $this;
  96.     }
  97.     public function getRow(): int
  98.     {
  99.         return $this->row ?? 1;
  100.     }
  101.     public function setRow(int $row): self
  102.     {
  103.         if ($row <= 0) {
  104.             $row 1;
  105.         }
  106.         $this->row $row;
  107.         return $this;
  108.     }
  109.     public function getType(): ?string
  110.     {
  111.         return $this->type;
  112.     }
  113.     public function setType(string $type): self
  114.     {
  115.         $this->type $type;
  116.         return $this;
  117.     }
  118.     public function getOriginalFilename(): ?string
  119.     {
  120.         return $this->originalFilename;
  121.     }
  122.     public function setOriginalFilename(string $originalFilename): self
  123.     {
  124.         $this->originalFilename $originalFilename;
  125.         return $this;
  126.     }
  127.     public function getOriginalPath(): ?string
  128.     {
  129.         return $this->originalPath;
  130.     }
  131.     public function setOriginalPath(string $originalPath): self
  132.     {
  133.         $this->originalPath $originalPath;
  134.         return $this;
  135.     }
  136.     public function getVariants(): array
  137.     {
  138.         return $this->variants ?? [];
  139.     }
  140.     public function setVariants(array $variants): self
  141.     {
  142.         $this->variants $variants;
  143.         return $this;
  144.     }
  145.     public function getStatus(): ?string
  146.     {
  147.         return $this->status;
  148.     }
  149.     public function setStatus(string $status): self
  150.     {
  151.         $this->status $status;
  152.         return $this;
  153.     }
  154.     public function getSourceType(): ?string
  155.     {
  156.         return $this->sourceType;
  157.     }
  158.     public function setSourceType(string $sourceType): self
  159.     {
  160.         $this->sourceType $sourceType;
  161.         return $this;
  162.     }
  163.     public function getSourceConfig(): ?array
  164.     {
  165.         return $this->sourceConfig;
  166.     }
  167.     public function setSourceConfig(?array $sourceConfig): self
  168.     {
  169.         $this->sourceConfig $sourceConfig;
  170.         return $this;
  171.     }
  172.     public function getCreatedAt(): \DateTimeImmutable
  173.     {
  174.         return $this->createdAt;
  175.     }
  176.     public function setCreatedAt(\DateTimeImmutable $createdAt): self
  177.     {
  178.         $this->createdAt $createdAt;
  179.         return $this;
  180.     }
  181.     public function getUpdatedAt(): \DateTimeImmutable
  182.     {
  183.         return $this->updatedAt;
  184.     }
  185.     public function setUpdatedAt(\DateTimeImmutable $updatedAt): self
  186.     {
  187.         $this->updatedAt $updatedAt;
  188.         return $this;
  189.     }
  190. }