src/Entity/File/File.php line 24
<?php
namespace App\Entity\File;
use ApiPlatform\Metadata\ApiProperty;
use App\Entity\Common;
use App\Entity\Identity\User;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
#[ORM\Table(name: 'file')]
#[ORM\Index(columns: ['created_by'], name: 'file_created_by_idx')]
#[ORM\Index(columns: ['updated_by'], name: 'file_updated_by_idx')]
#[ORM\UniqueConstraint(name: 'file_slug_key', columns: ['slug'])]
#[ORM\UniqueConstraint(name: 'file_path_key', columns: ['path'])]
#[ORM\InheritanceType('SINGLE_TABLE')]
#[ORM\DiscriminatorColumn(name: 'file_type')]
#[ORM\DiscriminatorMap([
'PARSABLE' => Parsable::class,
'UPLOADED' => Upload::class,
])]
#[ORM\Entity]
abstract class File
{
use Common\Blameable;
use Common\Trackable;
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'IDENTITY')]
#[ORM\SequenceGenerator(sequenceName: 'file_id_seq')]
#[ORM\Column(type: Types::INTEGER)]
#[ApiProperty(identifier: false)]
protected ?int $id = null;
#[Gedmo\Slug(fields: ['name'])]
#[ORM\Column(type: Types::STRING)]
#[ApiProperty(identifier: true)]
protected ?string $slug = null;
#[ORM\Column(type: Types::STRING)]
protected ?string $name = null;
#[ORM\Column(type: Types::STRING)]
protected ?string $originalName = null;
#[ORM\Column(type: Types::STRING)]
protected ?string $path = null;
#[ORM\Column(type: Types::STRING, nullable: true)]
protected ?string $description = null;
#[ORM\Column(type: Types::STRING)]
protected ?string $mimeType = null;
#[ORM\Column(type: Types::INTEGER)]
protected ?int $size = null;
/*
* Override Blameable User as this field could be null
*/
#[Gedmo\Blameable(on: 'create')]
#[ORM\ManyToOne(targetEntity: User::class)]
#[ORM\JoinColumn(name: 'created_by', nullable: true)]
protected ?User $createdBy = null;
public function getId(): ?int
{
return $this->id;
}
public function getSlug(): ?string
{
return $this->slug;
}
public function setSlug(string $slug): self
{
$this->slug = $slug;
return $this;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(?string $name): self
{
$this->name = $name;
return $this;
}
public function getOriginalName(): ?string
{
return $this->originalName;
}
public function setOriginalName(?string $originalName): self
{
$this->originalName = $originalName;
return $this;
}
public function getPath(): ?string
{
return $this->path;
}
public function setPath(string $path): self
{
$this->path = $path;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
public function getMimeType(): ?string
{
return $this->mimeType;
}
public function setMimeType(string $mimeType): self
{
$this->mimeType = $mimeType;
return $this;
}
public function getSize(): ?int
{
return $this->size;
}
public function setSize(int $size): self
{
$this->size = $size;
return $this;
}
}