WIP: feature_paste #1

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

View file

@ -20,10 +20,15 @@ class PasteFormData
skobkin marked this conversation as resolved
Review

Why string and Assert\NotBlank?

Why `string` and `Assert\NotBlank`?
public function __construct(?Paste $paste = null)
{
skobkin marked this conversation as resolved
Review

Is this validation being processed BEFORE storing the data in the DTO?
If not, it's pointless as with bool field earlier.

Is this validation being processed BEFORE storing the data in the DTO? If not, it's pointless as with `bool` field earlier.
if ($paste === null)
{
if ($paste === null) {
return;
skobkin marked this conversation as resolved
Review

Or you can make constructor private, use property promotion and add fromPaste() method to create it from the entity.

Or you can make constructor `private`, use property promotion and add `fromPaste()` method to create it from the entity.
}
$this->fromPaste($paste);
}
private function fromPaste(Paste $paste)
{
$this->text = $paste->text;
$this->private = $paste->secret !== null;
$this->language = $paste->language;