<?php
/**
* @package BLUUE
* @author Thomas HERISSON (contact@scaledev.fr)
* @copyright 2021 - ScaleDEV SAS, 12 RUE CHARLES MORET, 10120 ST ANDRE LES VERGERS
* @license commercial
*/
declare(strict_types=1);
namespace App\Entity;
use App\Repository\FileManagerRepository;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\SoftDeleteable\Traits\SoftDeleteable;
use Gedmo\Timestampable\Traits\TimestampableEntity;
use Symfony\Bridge\Doctrine\IdGenerator\UuidGenerator;
use Symfony\Component\Uid\Uuid;
/**
* @ORM\Entity(repositoryClass=FileManagerRepository::class)
*/
class FileManager
{
use TimestampableEntity;
use SoftDeleteable;
/**
* @ORM\Id
* @ORM\Column(type="uuid")
* @ORM\GeneratedValue(strategy="CUSTOM")
* @ORM\CustomIdGenerator(class=UuidGenerator::class)
*/
private ?Uuid $id = null;
/**
* @ORM\Column(type="string", length=255)
*/
private string $key_path;
/**
* @ORM\Column(type="text", nullable=true)
*/
private string $original_filename;
/**
* @ORM\Column(type="string", length=128)
*/
private string $mime_type;
/**
* @ORM\Column(type="string", length=15, nullable=true)
*/
private string $extension;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private ?int $size = null;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private int $width;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private int $height;
public function __construct()
{
}
/**
* @return Uuid|null
*/
public function getId(): ?Uuid
{
return $this->id;
}
/**
* @return string|null
*/
public function getKeyPath(): ?string
{
return $this->key_path;
}
/**
* @param string $key_path
* @return $this
*/
public function setKeyPath(string $key_path): self
{
$this->key_path = $key_path;
return $this;
}
/**
* @return string|null
*/
public function getOriginalFilename(): ?string
{
return $this->original_filename;
}
/**
* @param string|null $original_filename
* @return $this
*/
public function setOriginalFilename(?string $original_filename): self
{
$this->original_filename = $original_filename;
return $this;
}
/**
* @return string|null
*/
public function getMimeType(): ?string
{
return $this->mime_type;
}
/**
* @param string $mime_type
* @return $this
*/
public function setMimeType(string $mime_type): self
{
$this->mime_type = $mime_type;
return $this;
}
/**
* @return string|null
*/
public function getExtension(): ?string
{
return $this->extension;
}
/**
* @param string|null $extension
* @return $this
*/
public function setExtension(?string $extension): self
{
$this->extension = $extension;
return $this;
}
/**
* @return int|null
*/
public function getSize(): ?int
{
return $this->size;
}
/**
* @param int $size
* @return $this
*/
public function setSize(int $size): self
{
$this->size = $size;
return $this;
}
/**
* @return int|null
*/
public function getWidth(): ?int
{
return $this->width;
}
/**
* @param int|null $width
* @return $this
*/
public function setWidth(?int $width): self
{
$this->width = $width;
return $this;
}
/**
* @return int|null
*/
public function getHeight(): ?int
{
return $this->height;
}
/**
* @param int|null $height
* @return $this
*/
public function setHeight(?int $height): self
{
$this->height = $height;
return $this;
}
/**
* @return string
*/
public function getName(): string
{
$name = $this->getOriginalFilename();
return substr($name, 0, strrpos($name, '.'));
}
}