B
B
BonBon Slick2018-05-09 20:51:20
EAV
BonBon Slick, 2018-05-09 20:51:20

What methods can contain ValueObject?

In all primers, only
__toString, equals, getValue and that's all? For example, if I need to change the VO, the change?

class VOName{

public function change(string $value){
return new VOName($value);

Or should such a method contain an aggregate? Which consists of this VO?
What other methods can be and what are not, why?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
ddd329, 2018-09-19
@ddd329

ValueObject - may have a change method, but must only return a new value. For example, var fullName2 = fullName.ChangeLastName('Ivanov');
You can stick any subject logic there as well as in essence ...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question