Your experience on this site will be improved by allowing cookies.
DTOs are concerned only with the data types which appear in the data, rather than the business logic involved. Value objects, on the other hand, need to care about the specifics of the business domain, not just the types. They'll contain the logic which ensures that a string is an email address, for example, complaining loudly if not. Value objects also tend to be immutable. class EmployeeDTO { public function __construct( private string $name, private Phone $phone, private Email $email, private Salary $salary, .... ) }
Hozzászólások