Answer the question
In order to leave comments, you need to log in
Use new or static method as factory replacement?
The first option, such pieces are scattered throughout our application $dto = new SomeData($data)
.
The second option is scattered throughout the application such pieces: $dto = SomeDto::fromArray($data)
where inside we already use the new operator. It is a question specifically about DTO objects.
Personally, I like the second option more, I can't say why. Perhaps someone can explain why? And which option is better?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question