Apply rector rules: add annotation for doctrine mapping

This commit is contained in:
2024-04-05 00:01:30 +02:00
parent 579bd829f8
commit 72016e1a21
124 changed files with 1724 additions and 3770 deletions

View File

@@ -29,14 +29,14 @@ use Symfony\Component\Serializer\Annotation as Serializer;
* The property `$deleteAt` allow a deletion of the document after the given date. But this property should
* be set before the document is actually written by the StoredObjectManager.
*
* @ORM\Entity
*
* @ORM\Table("chill_doc.stored_object")
*
* @AsyncFileExists(
* message="The file is not stored properly"
* )
*/
#[ORM\Entity]
#[ORM\Table('chill_doc.stored_object')]
class StoredObject implements Document, TrackCreationInterface
{
use TrackCreationTrait;
@@ -44,63 +44,45 @@ class StoredObject implements Document, TrackCreationInterface
final public const STATUS_PENDING = 'pending';
final public const STATUS_FAILURE = 'failure';
/**
* @ORM\Column(type="json", name="datas")
*/
#[Serializer\Groups(['read', 'write'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON, name: 'datas')]
private array $datas = [];
/**
* @ORM\Column(type="text")
*/
#[Serializer\Groups(['read', 'write'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT)]
private string $filename = '';
/**
* @ORM\Id
*
* @ORM\GeneratedValue
*
* @ORM\Column(type="integer")
*/
#[Serializer\Groups(['read', 'write'])]
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
private ?int $id = null;
/**
* @var int[]
*
* @ORM\Column(type="json", name="iv")
*/
#[Serializer\Groups(['read', 'write'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON, name: 'iv')]
private array $iv = [];
/**
* @ORM\Column(type="json", name="key")
*/
#[Serializer\Groups(['read', 'write'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON, name: 'key')]
private array $keyInfos = [];
/**
* @ORM\Column(type="text", name="title")
*/
#[Serializer\Groups(['read', 'write'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, name: 'title')]
private string $title = '';
/**
* @ORM\Column(type="text", name="type", options={"default": ""})
*/
#[Serializer\Groups(['read', 'write'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, name: 'type', options: ['default' => ''])]
private string $type = '';
/**
* @ORM\Column(type="uuid", unique=true)
*/
#[Serializer\Groups(['read', 'write'])]
#[ORM\Column(type: 'uuid', unique: true)]
private UuidInterface $uuid;
/**
* @ORM\ManyToOne(targetEntity=DocGeneratorTemplate::class)
*/
#[ORM\ManyToOne(targetEntity: DocGeneratorTemplate::class)]
private ?DocGeneratorTemplate $template = null;
/**
@@ -108,28 +90,20 @@ class StoredObject implements Document, TrackCreationInterface
*
* This is a workaround, as generation consume lot of memory, and out-of-memory errors
* are not handled by messenger.
*
* @ORM\Column(type="integer", options={"default": 0})
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER, options: ['default' => 0])]
private int $generationTrialsCounter = 0;
/**
* @ORM\Column(type="datetime_immutable", nullable=true, options={"default": null})
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_IMMUTABLE, nullable: true, options: ['default' => null])]
private ?\DateTimeImmutable $deleteAt = null;
/**
* @ORM\Column(type="text", nullable=false, options={"default": ""})
*/
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: false, options: ['default' => ''])]
private string $generationErrors = '';
/**
* @param StoredObject::STATUS_* $status
*/
public function __construct(/**
* @ORM\Column(type="text", options={"default": "ready"})
*/
#[Serializer\Groups(['read'])]
public function __construct(#[Serializer\Groups(['read'])] #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, options: ['default' => 'ready'])]
private string $status = 'ready'
) {
$this->uuid = Uuid::uuid4();