mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 07:03:49 +00:00
apply more cs rules for php-cs
This commit is contained in:
@@ -18,19 +18,23 @@ use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* @ORM\Entity
|
||||
*
|
||||
* @ORM\Table("chill_doc.accompanyingcourse_document")
|
||||
*/
|
||||
class AccompanyingCourseDocument extends Document implements HasScopesInterface, HasCentersInterface
|
||||
{
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity=AccompanyingPeriod::class)
|
||||
*
|
||||
* @ORM\JoinColumn(nullable=false)
|
||||
*/
|
||||
private ?AccompanyingPeriod $course = null;
|
||||
|
||||
/**
|
||||
* @ORM\Id
|
||||
*
|
||||
* @ORM\GeneratedValue
|
||||
*
|
||||
* @ORM\Column(type="integer")
|
||||
*/
|
||||
private ?int $id = null;
|
||||
@@ -65,5 +69,4 @@ class AccompanyingCourseDocument extends Document implements HasScopesInterface,
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -16,8 +16,6 @@ use Chill\MainBundle\Doctrine\Model\TrackCreationInterface;
|
||||
use Chill\MainBundle\Doctrine\Model\TrackCreationTrait;
|
||||
use Chill\MainBundle\Doctrine\Model\TrackUpdateInterface;
|
||||
use Chill\MainBundle\Doctrine\Model\TrackUpdateTrait;
|
||||
use Chill\MainBundle\Entity\User;
|
||||
use DateTimeInterface;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
@@ -32,7 +30,9 @@ class Document implements TrackCreationInterface, TrackUpdateInterface
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="Chill\DocStoreBundle\Entity\DocumentCategory")
|
||||
*
|
||||
* @ORM\JoinColumns({
|
||||
*
|
||||
* @ORM\JoinColumn(name="category_bundle_id", referencedColumnName="bundle_id"),
|
||||
* @ORM\JoinColumn(name="category_id_inside_bundle", referencedColumnName="id_inside_bundle")
|
||||
* })
|
||||
@@ -54,7 +54,9 @@ class Document implements TrackCreationInterface, TrackUpdateInterface
|
||||
* targetEntity="Chill\DocStoreBundle\Entity\StoredObject",
|
||||
* cascade={"persist"}
|
||||
* )
|
||||
*
|
||||
* @Assert\Valid
|
||||
*
|
||||
* @Assert\NotNull(
|
||||
* message="Upload a document"
|
||||
* )
|
||||
@@ -68,6 +70,7 @@ class Document implements TrackCreationInterface, TrackUpdateInterface
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="text")
|
||||
*
|
||||
* @Assert\Length(
|
||||
* min=2, max=250
|
||||
* )
|
||||
@@ -84,7 +87,7 @@ class Document implements TrackCreationInterface, TrackUpdateInterface
|
||||
return $this->category;
|
||||
}
|
||||
|
||||
public function getDate(): ?DateTimeInterface
|
||||
public function getDate(): ?\DateTimeInterface
|
||||
{
|
||||
return $this->date;
|
||||
}
|
||||
@@ -121,7 +124,7 @@ class Document implements TrackCreationInterface, TrackUpdateInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setDate(DateTimeInterface $date): self
|
||||
public function setDate(\DateTimeInterface $date): self
|
||||
{
|
||||
$this->date = $date;
|
||||
|
||||
@@ -135,7 +138,7 @@ class Document implements TrackCreationInterface, TrackUpdateInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setObject(?StoredObject $object = null)
|
||||
public function setObject(StoredObject $object = null)
|
||||
{
|
||||
$this->object = $object;
|
||||
|
||||
|
@@ -15,6 +15,7 @@ use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* @ORM\Table("chill_doc.document_category")
|
||||
*
|
||||
* @ORM\Entity
|
||||
*/
|
||||
class DocumentCategory
|
||||
@@ -33,11 +34,12 @@ class DocumentCategory
|
||||
|
||||
/**
|
||||
* @param string $bundleId
|
||||
* @param int $idInsideBundle
|
||||
* @param int $idInsideBundle
|
||||
*/
|
||||
public function __construct(
|
||||
/**
|
||||
* @ORM\Id
|
||||
*
|
||||
* @ORM\Column(type="string", name="bundle_id")
|
||||
*
|
||||
* @var string The id of the bundle that has create the category (i.e. 'person', 'activity', ....)
|
||||
@@ -45,6 +47,7 @@ class DocumentCategory
|
||||
private $bundleId,
|
||||
/**
|
||||
* @ORM\Id
|
||||
*
|
||||
* @ORM\Column(type="integer", name="id_inside_bundle")
|
||||
*
|
||||
* @var int The id which is unique inside the bundle
|
||||
|
@@ -19,13 +19,16 @@ use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* @ORM\Table("chill_doc.person_document")
|
||||
*
|
||||
* @ORM\Entity
|
||||
*/
|
||||
class PersonDocument extends Document implements HasCenterInterface, HasScopeInterface
|
||||
{
|
||||
/**
|
||||
* @ORM\Id
|
||||
*
|
||||
* @ORM\GeneratedValue
|
||||
*
|
||||
* @ORM\Column(type="integer")
|
||||
*/
|
||||
private ?int $id = null;
|
||||
|
@@ -17,8 +17,6 @@ use ChampsLibres\WopiLib\Contract\Entity\Document;
|
||||
use Chill\DocGeneratorBundle\Entity\DocGeneratorTemplate;
|
||||
use Chill\MainBundle\Doctrine\Model\TrackCreationInterface;
|
||||
use Chill\MainBundle\Doctrine\Model\TrackCreationTrait;
|
||||
use DateTime;
|
||||
use DateTimeInterface;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Ramsey\Uuid\Uuid;
|
||||
use Ramsey\Uuid\UuidInterface;
|
||||
@@ -28,7 +26,9 @@ 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"
|
||||
* )
|
||||
@@ -36,57 +36,68 @@ use Symfony\Component\Serializer\Annotation as Serializer;
|
||||
class StoredObject implements AsyncFileInterface, Document, TrackCreationInterface
|
||||
{
|
||||
use TrackCreationTrait;
|
||||
final public const STATUS_READY = "ready";
|
||||
final public const STATUS_PENDING = "pending";
|
||||
final public const STATUS_FAILURE = "failure";
|
||||
final public const STATUS_READY = 'ready';
|
||||
final public const STATUS_PENDING = 'pending';
|
||||
final public const STATUS_FAILURE = 'failure';
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="json", name="datas")
|
||||
*
|
||||
* @Serializer\Groups({"read", "write"})
|
||||
*/
|
||||
private array $datas = [];
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="text")
|
||||
*
|
||||
* @Serializer\Groups({"read", "write"})
|
||||
*/
|
||||
private string $filename = '';
|
||||
|
||||
/**
|
||||
* @ORM\Id
|
||||
*
|
||||
* @ORM\GeneratedValue
|
||||
*
|
||||
* @ORM\Column(type="integer")
|
||||
*
|
||||
* @Serializer\Groups({"read", "write"})
|
||||
*/
|
||||
private ?int $id = null;
|
||||
|
||||
/**
|
||||
* @var int[]
|
||||
*
|
||||
* @ORM\Column(type="json", name="iv")
|
||||
*
|
||||
* @Serializer\Groups({"read", "write"})
|
||||
*/
|
||||
private array $iv = [];
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="json", name="key")
|
||||
*
|
||||
* @Serializer\Groups({"read", "write"})
|
||||
*/
|
||||
private array $keyInfos = [];
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="text", name="title")
|
||||
*
|
||||
* @Serializer\Groups({"read", "write"})
|
||||
*/
|
||||
private string $title = '';
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="text", name="type", options={"default": ""})
|
||||
*
|
||||
* @Serializer\Groups({"read", "write"})
|
||||
*/
|
||||
private string $type = '';
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="uuid", unique=true)
|
||||
*
|
||||
* @Serializer\Groups({"read", "write"})
|
||||
*/
|
||||
private UuidInterface $uuid;
|
||||
@@ -111,27 +122,29 @@ class StoredObject implements AsyncFileInterface, Document, TrackCreationInterfa
|
||||
*/
|
||||
public function __construct(/**
|
||||
* @ORM\Column(type="text", options={"default": "ready"})
|
||||
*
|
||||
* @Serializer\Groups({"read"})
|
||||
*/
|
||||
private string $status = "ready"
|
||||
private string $status = 'ready'
|
||||
) {
|
||||
$this->uuid = Uuid::uuid4();
|
||||
}
|
||||
|
||||
public function addGenerationTrial(): self
|
||||
{
|
||||
$this->generationTrialsCounter++;
|
||||
++$this->generationTrialsCounter;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Serializer\Groups({"read", "write"})
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
public function getCreationDate(): DateTime
|
||||
public function getCreationDate(): \DateTime
|
||||
{
|
||||
return DateTime::createFromImmutable($this->createdAt);
|
||||
return \DateTime::createFromImmutable($this->createdAt);
|
||||
}
|
||||
|
||||
public function getDatas(): array
|
||||
@@ -165,7 +178,7 @@ class StoredObject implements AsyncFileInterface, Document, TrackCreationInterfa
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use method "getFilename()".
|
||||
* @deprecated use method "getFilename()"
|
||||
*/
|
||||
public function getObjectName()
|
||||
{
|
||||
@@ -202,9 +215,10 @@ class StoredObject implements AsyncFileInterface, Document, TrackCreationInterfa
|
||||
|
||||
/**
|
||||
* @Serializer\Groups({"write"})
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
public function setCreationDate(DateTime $creationDate): self
|
||||
public function setCreationDate(\DateTime $creationDate): self
|
||||
{
|
||||
$this->createdAt = \DateTimeImmutable::createFromMutable($creationDate);
|
||||
|
||||
@@ -276,6 +290,7 @@ class StoredObject implements AsyncFileInterface, Document, TrackCreationInterfa
|
||||
public function setTemplate(?DocGeneratorTemplate $template): StoredObject
|
||||
{
|
||||
$this->template = $template;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user