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 callSeems 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
Architecture Best Practice (MVC): Repository Returns Object & Object Member Accessed Directly or Repository Returns Object Member
php;object oriented design;encapsulation;coupling;single responsibility