WIP: feature_paste #1

Draft
Miroslavsckaya wants to merge 24 commits from feature_paste into master
Showing only changes of commit ddfbba344a - Show all commits

View file

@ -4,7 +4,6 @@ declare(strict_types = 1);
namespace App\Entity; namespace App\Entity;
use App\DTO\PasteFormData; use App\DTO\PasteFormData;
use App\Repository\PasteRepository; use App\Repository\PasteRepository;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: PasteRepository::class)] #[ORM\Entity(repositoryClass: PasteRepository::class)]
Review

I'd suggest explicitly defining Table attribute here.

Especially since you're defining Column attributes below ⬇️

I'd suggest explicitly defining `Table` attribute here. Especially since you're defining `Column` attributes below ⬇️
Review

I'd also suggest to make this entity readonly. It'll give some performance benefits.

You can read about that here.

I'd also suggest to make this entity readonly. It'll give some performance benefits. You can read about that [here](https://www.doctrine-project.org/projects/doctrine-orm/en/2.15/reference/attributes-reference.html#attrref_entity).
@ -18,21 +17,21 @@ class Paste
private function __construct( private function __construct(
skobkin marked this conversation as resolved Outdated

No need for double quotes here too.

No need for double quotes here too.
#[ORM\Column(type: 'text', nullable: false)] #[ORM\Column(type: 'text', nullable: false)]
public readonly string $text, public readonly string $text,
#[ORM\Column(length: 25, nullable: true)] #[ORM\Column(type: 'string', length: 25, nullable: true)]
public readonly ?string $language, public readonly ?string $language,
#[ORM\Column(type: 'text', nullable: true)] #[ORM\Column(type: 'text', nullable: true)]
public readonly ?string $description, public readonly ?string $description,
#[ORM\Column(length: 128, nullable: true)] #[ORM\Column(type: 'string', length: 128, nullable: true)]
public readonly ?string $filename, public readonly ?string $filename,

What type? Why 25 exactly?

What type? Why 25 exactly?
Review

Why 128?

Why 128?
#[ORM\Column(length: 128, nullable: false)] #[ORM\Column(type: 'string', length: 128, nullable: false)]
public readonly string $author, public readonly string $author,
skobkin marked this conversation as resolved Outdated

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, public readonly \DateTimeImmutable $publishDate,
#[ORM\Column(type: Types::DATETIME_IMMUTABLE, nullable: true)] #[ORM\Column(type: 'datetime_immutable', nullable: true)]
public readonly ?\DateTimeImmutable $expirationDate, public readonly ?\DateTimeImmutable $expirationDate,
#[ORM\Column(length: 15, nullable: false)] #[ORM\Column(type: 'string', length: 15, nullable: false)]
public readonly string $ip, public readonly string $ip,
skobkin marked this conversation as resolved
Review

IPv6?

IPv6?
#[ORM\Column(length: 40, nullable: true)] #[ORM\Column(type: 'string', length: 40, nullable: true)]
public readonly ?string $secret, public readonly ?string $secret,
) {} ) {}
skobkin marked this conversation as resolved Outdated

Why double quotes?

Why double quotes?