mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 13:24:25 +00:00
160 lines
2.9 KiB
PHP
160 lines
2.9 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Chill\DocStoreBundle\Entity;
|
|
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
use ChampsLibres\AsyncUploaderBundle\Model\AsyncFileInterface;
|
|
use ChampsLibres\AsyncUploaderBundle\Validator\Constraints\AsyncFileExists;
|
|
use DateTimeInterface;
|
|
use Symfony\Component\Serializer\Annotation as Serializer;
|
|
|
|
/**
|
|
* Represent a document stored in an object store
|
|
*
|
|
* @ORM\Entity()
|
|
* @ORM\Table("chill_doc.stored_object")
|
|
* @AsyncFileExists(
|
|
* message="The file is not stored properly"
|
|
* )
|
|
*/
|
|
class StoredObject implements AsyncFileInterface
|
|
{
|
|
/**
|
|
* @ORM\Id()
|
|
* @ORM\GeneratedValue()
|
|
* @ORM\Column(type="integer")
|
|
* @Serializer\Groups({"read"})
|
|
*/
|
|
private $id;
|
|
|
|
/**
|
|
* @ORM\Column(type="text")
|
|
* @Serializer\Groups({"read"})
|
|
*/
|
|
private $filename;
|
|
|
|
/**
|
|
* @ORM\Column(type="json_array", name="key")
|
|
*/
|
|
private array $keyInfos = [];
|
|
|
|
/**
|
|
*
|
|
* @var int[]
|
|
* @ORM\Column(type="json_array", name="iv")
|
|
*/
|
|
private array $iv = [];
|
|
|
|
/**
|
|
* @ORM\Column(type="datetime", name="creation_date")
|
|
* @Serializer\Groups({"read"})
|
|
*/
|
|
private DateTimeInterface $creationDate;
|
|
|
|
/**
|
|
* @ORM\Column(type="text", name="type")
|
|
* @Serializer\Groups({"read"})
|
|
*/
|
|
private string $type = '';
|
|
|
|
/**
|
|
* @ORM\Column(type="json_array", name="datas")
|
|
* @Serializer\Groups({"read"})
|
|
*/
|
|
private array $datas = [];
|
|
|
|
public function __construct()
|
|
{
|
|
$this->creationDate = new \DateTime();
|
|
}
|
|
|
|
public function getId()
|
|
{
|
|
return $this->id;
|
|
}
|
|
|
|
public function getFilename()
|
|
{
|
|
return $this->filename;
|
|
}
|
|
|
|
public function getCreationDate(): \DateTime
|
|
{
|
|
return $this->creationDate;
|
|
}
|
|
|
|
public function getType()
|
|
{
|
|
return $this->type;
|
|
}
|
|
|
|
public function getDatas()
|
|
{
|
|
return $this->datas;
|
|
}
|
|
|
|
public function setFilename($filename)
|
|
{
|
|
$this->filename = $filename;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function setCreationDate(\DateTime $creationDate)
|
|
{
|
|
$this->creationDate = $creationDate;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function setType($type)
|
|
{
|
|
$this->type = $type;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function setDatas(array $datas)
|
|
{
|
|
$this->datas = $datas;
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @deprecated Use method "getFilename()".
|
|
*/
|
|
public function getObjectName()
|
|
{
|
|
return $this->getFilename();
|
|
}
|
|
|
|
public function getKeyInfos()
|
|
{
|
|
return $this->keyInfos;
|
|
}
|
|
|
|
public function getIv()
|
|
{
|
|
return $this->iv;
|
|
}
|
|
|
|
public function setKeyInfos($keyInfos)
|
|
{
|
|
$this->keyInfos = $keyInfos;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function setIv($iv)
|
|
{
|
|
$this->iv = $iv;
|
|
|
|
return $this;
|
|
}
|
|
|
|
|
|
}
|