diff --git a/src/Bundle/ChillDocStoreBundle/Entity/StoredObject.php b/src/Bundle/ChillDocStoreBundle/Entity/StoredObject.php index 9c88e502d..7ba21b5da 100644 --- a/src/Bundle/ChillDocStoreBundle/Entity/StoredObject.php +++ b/src/Bundle/ChillDocStoreBundle/Entity/StoredObject.php @@ -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; + } }