Architecturally speaking, which is the preferable approach (and why)?
$validation_date = $users_repository->getUser($user_id)->validation_date;
- Seems to violate Law of Demeter by accessing member of object returned by method call
- Seems to violate Encapsulation by accessing object member directly
$validation_date = $users_repository->getUserValidationDate($user_id);
- Seems to violate Single Responsibility Principle as $users_repository no longer just returns User objects