DBAL types added to all Paste class properties

This commit is contained in:
mitsuha_s 2023-07-22 17:29:24 +03:00
parent c164ed446b
commit ddfbba344a

View file

@ -4,7 +4,6 @@ declare(strict_types = 1);
namespace App\Entity;
use App\DTO\PasteFormData;
use App\Repository\PasteRepository;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: PasteRepository::class)]
@ -18,21 +17,21 @@ class Paste
private function __construct(
#[ORM\Column(type: 'text', nullable: false)]
public readonly string $text,
#[ORM\Column(length: 25, nullable: true)]
#[ORM\Column(type: 'string', length: 25, nullable: true)]
public readonly ?string $language,
#[ORM\Column(type: 'text', nullable: true)]
public readonly ?string $description,
#[ORM\Column(length: 128, nullable: true)]
#[ORM\Column(type: 'string', length: 128, nullable: true)]
public readonly ?string $filename,
#[ORM\Column(length: 128, nullable: false)]
#[ORM\Column(type: 'string', length: 128, nullable: false)]
public readonly string $author,
#[ORM\Column(type: Types::DATETIME_IMMUTABLE, nullable: false)]
#[ORM\Column(type: 'datetime_immutable', nullable: false)]
public readonly \DateTimeImmutable $publishDate,
#[ORM\Column(type: Types::DATETIME_IMMUTABLE, nullable: true)]
#[ORM\Column(type: 'datetime_immutable', nullable: true)]
public readonly ?\DateTimeImmutable $expirationDate,
#[ORM\Column(length: 15, nullable: false)]
#[ORM\Column(type: 'string', length: 15, nullable: false)]
public readonly string $ip,
#[ORM\Column(length: 40, nullable: true)]
#[ORM\Column(type: 'string', length: 40, nullable: true)]
public readonly ?string $secret,
) {}