cs: Fix code style (safe rules only).

This commit is contained in:
Pol Dellaiera
2021-11-23 14:06:38 +01:00
parent 149d7ce991
commit 8f96a1121d
1223 changed files with 65199 additions and 64625 deletions

View File

@@ -1,13 +1,19 @@
<?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.
*/
namespace Chill\DocStoreBundle\Entity;
use Chill\DocStoreBundle\Entity\Document;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity()
* @ORM\Entity
* @ORM\Table("chill_doc.accompanyingcourse_document")
*/
class AccompanyingCourseDocument extends Document

View File

@@ -1,33 +1,38 @@
<?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.
*/
namespace Chill\DocStoreBundle\Entity;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Chill\MainBundle\Entity\HasScopeInterface;
use Chill\MainBundle\Entity\User;
use ChampsLibres\AsyncUploaderBundle\Validator\Constraints\AsyncFileExists;
use DateTimeInterface;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\MappedSuperclass()
* @ORM\MappedSuperclass
*/
class Document implements HasScopeInterface
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
* @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")
* })
*/
private $id;
private $category;
/**
* @ORM\Column(type="text")
* @Assert\Length(
* min=2, max=250
* )
* @ORM\Column(type="datetime")
*/
private $title;
private $date;
/**
* @ORM\Column(type="text")
@@ -35,72 +40,46 @@ class Document implements HasScopeInterface
private $description = '';
/**
* @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")
* })
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $category;
private $id;
/**
* @ORM\ManyToOne(
* targetEntity="Chill\DocStoreBundle\Entity\StoredObject",
* cascade={"persist"}
* targetEntity="Chill\DocStoreBundle\Entity\StoredObject",
* cascade={"persist"}
* )
* @Assert\Valid()
* @Assert\Valid
* @Assert\NotNull(
* message="Upload a document"
* message="Upload a document"
* )
*/
private $object;
/**
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Scope")
*
* @var \Chill\MainBundle\Entity\Scope The document's center
*/
private $scope;
/**
* @ORM\Column(type="text")
* @Assert\Length(
* min=2, max=250
* )
*/
private $title;
/**
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\User")
*
* @var \Chill\PersonBundle\Entity\user The user who encoded the exif_read_data
*/
private $user;
/**
* @ORM\Column(type="datetime")
*/
private $date;
public function getId()
{
return $this->id;
}
public function getTitle(): ?string
{
return $this->title;
}
public function setTitle(string $title): self
{
$this->title = $title;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription($description): self
{
$this->description = (string) $description;
return $this;
}
/**
* @return DocumentCategory
*/
@@ -109,6 +88,46 @@ class Document implements HasScopeInterface
return $this->category;
}
public function getDate(): ?DateTimeInterface
{
return $this->date;
}
public function getDescription(): ?string
{
return $this->description;
}
public function getId()
{
return $this->id;
}
public function getObject(): ?StoredObject
{
return $this->object;
}
/**
* Get scope.
*
* @return \Chill\MainBundle\Entity\Scope
*/
public function getScope()
{
return $this->scope;
}
public function getTitle(): ?string
{
return $this->title;
}
public function getUser()
{
return $this->user;
}
public function setCategory(DocumentCategory $category): self
{
$this->category = $category;
@@ -116,14 +135,25 @@ class Document implements HasScopeInterface
return $this;
}
/**
* Get scope
*
* @return \Chill\MainBundle\Entity\Scope
*/
public function getScope()
public function setDate(DateTimeInterface $date): self
{
return $this->scope;
$this->date = $date;
return $this;
}
public function setDescription($description): self
{
$this->description = (string) $description;
return $this;
}
public function setObject(?StoredObject $object = null)
{
$this->object = $object;
return $this;
}
public function setScope($scope): self
@@ -133,9 +163,11 @@ class Document implements HasScopeInterface
return $this;
}
public function getUser()
public function setTitle(string $title): self
{
return $this->user;
$this->title = $title;
return $this;
}
public function setUser($user): self
@@ -144,28 +176,4 @@ class Document implements HasScopeInterface
return $this;
}
public function getDate(): ?\DateTimeInterface
{
return $this->date;
}
public function setDate(\DateTimeInterface $date): self
{
$this->date = $date;
return $this;
}
public function getObject(): ?StoredObject
{
return $this->object;
}
public function setObject(StoredObject $object = null)
{
$this->object = $object;
return $this;
}
}

View File

@@ -1,9 +1,14 @@
<?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.
*/
namespace Chill\DocStoreBundle\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
@@ -13,25 +18,27 @@ use Doctrine\ORM\Mapping as ORM;
class DocumentCategory
{
/**
* @ORM\Id()
* @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', ....)
*/
private $bundleId;
/**
* @ORM\Id()
* @ORM\Column(type="integer", name="id_inside_bundle")
* @var int The id which is unique inside the bundle
*/
private $idInsideBundle;
/**
* @ORM\Column(type="string", name="document_class")
*
* @var string The class of the document (ie Chill\DocStoreBundle\PersonDocument)
*/
private $documentClass;
/**
* @ORM\Id
* @ORM\Column(type="integer", name="id_inside_bundle")
*
* @var int The id which is unique inside the bundle
*/
private $idInsideBundle;
/**
* @ORM\Column(type="json")
@@ -44,19 +51,38 @@ class DocumentCategory
$this->idInsideBundle = $idInsideBundle;
}
public function getBundleId() // ::class BundleClass (FQDN)
public function getBundleId() // ::class BundleClass (FQDN)
{
return $this->bundleId;
}
public function getDocumentClass()
{
return $this->documentClass;
}
public function getIdInsideBundle()
{
return $this->idInsideBundle;
}
public function getDocumentClass()
public function getName($locale = null)
{
return $this->documentClass;
if ($locale) {
if (isset($this->name[$locale])) {
return $this->name[$locale];
}
foreach ($this->name as $name) {
if (!empty($name)) {
return $name;
}
}
return '';
}
return $this->name;
}
public function setDocumentClass($documentClass): self
@@ -66,24 +92,6 @@ class DocumentCategory
return $this;
}
public function getName($locale = null)
{
if ($locale) {
if (isset($this->name[$locale])) {
return $this->name[$locale];
} else {
foreach ($this->name as $name) {
if (!empty($name)) {
return $name;
}
}
}
return '';
} else {
return $this->name;
}
}
public function setName($name): self
{
$this->name = $name;

View File

@@ -1,29 +1,39 @@
<?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.
*/
namespace Chill\DocStoreBundle\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Chill\MainBundle\Entity\HasCenterInterface;
use Chill\MainBundle\Entity\HasScopeInterface;
use Chill\PersonBundle\Entity\Person;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Table("chill_doc.person_document")
* @ORM\Entity()
* @ORM\Entity
*/
class PersonDocument extends Document implements HasCenterInterface, HasScopeInterface
{
/**
* @ORM\ManyToOne(targetEntity="Chill\PersonBundle\Entity\Person")
*
* @var Person
*/
private $person;
public function getCenter()
{
return $this->getPerson()->getCenter();
}
/**
* Get person
* Get person.
*
* @return \Chill\MainBundle\Entity\Person
*/
@@ -38,9 +48,4 @@ class PersonDocument extends Document implements HasCenterInterface, HasScopeInt
return $this;
}
public function getCenter()
{
return $this->getPerson()->getCenter();
}
}

View File

@@ -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;
}
}