WIP: feature_paste #1
|
@ -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(
|
||||
skobkin marked this conversation as resolved
Outdated
skobkin
commented
No need for double quotes here too. No need for double quotes here too.
|
||||
#[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,
|
||||
skobkin
commented
What type? Why 25 exactly? What type? Why 25 exactly?
skobkin
commented
Why 128? Why 128?
|
||||
#[ORM\Column(length: 128, nullable: false)]
|
||||
#[ORM\Column(type: 'string', length: 128, nullable: false)]
|
||||
public readonly string $author,
|
||||
skobkin marked this conversation as resolved
Outdated
skobkin
commented
Why not nullable? Why not nullable?
|
||||
#[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,
|
||||
) {}
|
||||
skobkin marked this conversation as resolved
Outdated
skobkin
commented
Why double quotes? Why double quotes?
|
||||
|
||||
|
|
Loading…
Reference in a new issue
I'd suggest explicitly defining
Table
attribute here.Especially since you're defining
Column
attributes below ⬇️I'd also suggest to make this entity readonly. It'll give some performance benefits.
You can read about that here.