WIP: feature_paste #1
|
@ -20,10 +20,15 @@ class PasteFormData
|
|||
|
||||
skobkin marked this conversation as resolved
|
||||
public function __construct(?Paste $paste = null)
|
||||
{
|
||||
skobkin marked this conversation as resolved
skobkin
commented
Is this validation being processed BEFORE storing the data in the DTO? 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
skobkin
commented
Or you can make constructor 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;
|
||||
|
|
Loading…
Reference in a new issue
Why
string
andAssert\NotBlank
?