mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 07:03:49 +00:00
cs: Fix code style (safe rules only).
This commit is contained in:
@@ -1,36 +1,48 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
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 ChampsLibres\WopiLib\Contract\Entity\Document;
|
||||
use DateTime;
|
||||
use DateTimeInterface;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Ramsey\Uuid\Uuid;
|
||||
use Ramsey\Uuid\UuidInterface;
|
||||
use Symfony\Component\Serializer\Annotation as Serializer;
|
||||
|
||||
/**
|
||||
* Represent a document stored in an object store
|
||||
* Represent a document stored in an object store.
|
||||
*
|
||||
* @ORM\Entity()
|
||||
* @ORM\Entity
|
||||
* @ORM\Table("chill_doc.stored_object")
|
||||
* @AsyncFileExists(
|
||||
* message="The file is not stored properly"
|
||||
* message="The file is not stored properly"
|
||||
* )
|
||||
*/
|
||||
class StoredObject implements AsyncFileInterface, Document
|
||||
{
|
||||
/**
|
||||
* @ORM\Id()
|
||||
* @ORM\GeneratedValue()
|
||||
* @ORM\Column(type="integer")
|
||||
* @ORM\Column(type="datetime", name="creation_date")
|
||||
* @Serializer\Groups({"read"})
|
||||
*/
|
||||
private $id;
|
||||
private DateTimeInterface $creationDate;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="json", name="datas")
|
||||
* @Serializer\Groups({"read"})
|
||||
*/
|
||||
private array $datas = [];
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="text")
|
||||
@@ -39,28 +51,23 @@ class StoredObject implements AsyncFileInterface, Document
|
||||
private $filename;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="json", name="key")
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue
|
||||
* @ORM\Column(type="integer")
|
||||
* @Serializer\Groups({"read"})
|
||||
*/
|
||||
private array $keyInfos = [];
|
||||
private $id;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var int[]
|
||||
* @ORM\Column(type="json", name="iv")
|
||||
*/
|
||||
private array $iv = [];
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="uuid", unique=true)
|
||||
* @Serializer\Groups({"read"})
|
||||
* @ORM\Column(type="json", name="key")
|
||||
*/
|
||||
private UuidInterface $uuid;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="datetime", name="creation_date")
|
||||
* @Serializer\Groups({"read"})
|
||||
*/
|
||||
private DateTimeInterface $creationDate;
|
||||
private array $keyInfos = [];
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="text", name="type")
|
||||
@@ -69,68 +76,45 @@ class StoredObject implements AsyncFileInterface, Document
|
||||
private string $type = '';
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="json", name="datas")
|
||||
* @ORM\Column(type="uuid", unique=true)
|
||||
* @Serializer\Groups({"read"})
|
||||
*/
|
||||
private array $datas = [];
|
||||
private UuidInterface $uuid;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->creationDate = new \DateTime();
|
||||
$this->creationDate = new DateTime();
|
||||
$this->uuid = Uuid::uuid4();
|
||||
}
|
||||
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getFilename()
|
||||
{
|
||||
return $this->filename;
|
||||
}
|
||||
|
||||
public function getCreationDate(): \DateTime
|
||||
public function getCreationDate(): DateTime
|
||||
{
|
||||
return $this->creationDate;
|
||||
}
|
||||
|
||||
public function getType()
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
public function getDatas()
|
||||
{
|
||||
return $this->datas;
|
||||
}
|
||||
|
||||
public function setFilename($filename)
|
||||
public function getFilename()
|
||||
{
|
||||
$this->filename = $filename;
|
||||
|
||||
return $this;
|
||||
return $this->filename;
|
||||
}
|
||||
|
||||
public function setCreationDate(\DateTime $creationDate)
|
||||
public function getId()
|
||||
{
|
||||
$this->creationDate = $creationDate;
|
||||
|
||||
return $this;
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function setType($type)
|
||||
public function getIv()
|
||||
{
|
||||
$this->type = $type;
|
||||
|
||||
return $this;
|
||||
return $this->iv;
|
||||
}
|
||||
|
||||
public function setDatas(array $datas)
|
||||
public function getKeyInfos()
|
||||
{
|
||||
$this->datas = $datas;
|
||||
|
||||
return $this;
|
||||
return $this->keyInfos;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -141,28 +125,9 @@ class StoredObject implements AsyncFileInterface, Document
|
||||
return $this->getFilename();
|
||||
}
|
||||
|
||||
public function getKeyInfos()
|
||||
public function getType()
|
||||
{
|
||||
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;
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
public function getUuid(): UuidInterface
|
||||
@@ -174,4 +139,46 @@ class StoredObject implements AsyncFileInterface, Document
|
||||
{
|
||||
return (string) $this->uuid;
|
||||
}
|
||||
|
||||
public function setCreationDate(DateTime $creationDate)
|
||||
{
|
||||
$this->creationDate = $creationDate;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setDatas(array $datas)
|
||||
{
|
||||
$this->datas = $datas;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setFilename($filename)
|
||||
{
|
||||
$this->filename = $filename;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setIv($iv)
|
||||
{
|
||||
$this->iv = $iv;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setKeyInfos($keyInfos)
|
||||
{
|
||||
$this->keyInfos = $keyInfos;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setType($type)
|
||||
{
|
||||
$this->type = $type;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user