Update StoredObject entity.

This commit is contained in:
Pol Dellaiera 2021-09-28 17:42:28 +02:00
parent 59fcd1e96b
commit dcb92b1378

View File

@ -7,7 +7,9 @@ namespace Chill\DocStoreBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use ChampsLibres\AsyncUploaderBundle\Model\AsyncFileInterface;
use ChampsLibres\AsyncUploaderBundle\Validator\Constraints\AsyncFileExists;
use ChampsLibres\WopiLib\Contract\Entity\Document;
use DateTimeInterface;
use Ramsey\Uuid\Uuid;
use Symfony\Component\Serializer\Annotation as Serializer;
/**
@ -19,7 +21,7 @@ use Symfony\Component\Serializer\Annotation as Serializer;
* message="The file is not stored properly"
* )
*/
class StoredObject implements AsyncFileInterface
class StoredObject implements AsyncFileInterface, Document
{
/**
* @ORM\Id()
@ -47,6 +49,11 @@ class StoredObject implements AsyncFileInterface
*/
private array $iv = [];
/**
* @ORM\Column(type="uuid", unique=true)
*/
private Uuid $uuid;
/**
* @ORM\Column(type="datetime", name="creation_date")
* @Serializer\Groups({"read"})
@ -68,6 +75,7 @@ class StoredObject implements AsyncFileInterface
public function __construct()
{
$this->creationDate = new \DateTime();
$this->uuid = Uuid::uuid4();
}
public function getId()
@ -155,5 +163,13 @@ class StoredObject implements AsyncFileInterface
return $this;
}
public function getUuid(): Uuid
{
return $this->uuid;
}
public function getWopiDocId(): string
{
return (string) $this->uuid;
}
}