This should be one of the top 100 viewed videos regarding Laravel on KZitem.
9 ай бұрын
Thank you so much Ryan!
@minimerceloki
Жыл бұрын
vc é brabo demais!!
@darkbelg
Жыл бұрын
Are value objects an evolution of DTOs?
@williamxsp
Жыл бұрын
Kinda. DTO just cares about the shape of the data. In this case, temperature is an integer so thats it. It doesnt validate and it doesnt care about the business. It just force you to have the data in the format that you need (array, string, integer and so on). Once you need to have valid data in the domain perspective, like temperature cant be below -20 you have a value object. Not an evolution but just different use cases.
@misbahansori
Жыл бұрын
Is the value object also responsible to convert the temperature from one unit to another? for example: $temperature = new temperature(100, 'celsius'); $temperature->getFahrenheit(); // 212 or $temperature = Temperature::fromCelsius(100);
@chlouis-girardot
Жыл бұрын
for me, yes !
Жыл бұрын
It’s common to have formatting inside a VO. Just try not to go overboard with it :-)
@bienvenurandrianarison6332
11 ай бұрын
What font are you used for your phpstorm?
10 ай бұрын
Operator Mono
@mabdullahsari
Жыл бұрын
Instructions unclear. $request->validate(['temp' => ['min:-20', 'max:60']]); Problem solved.
@williamxsp
Жыл бұрын
That works from the http request perspective but sometimes you will find yourself reading data from a CSV uploaded by the user or from a command line. Value objects can be useful in such situations.
Пікірлер: 13