Should a Post entity have a user_id property which corresponds to the primary key (id) of a User entity, or should it instead have an author property which holds a reference to the actual User entity itself?
It seems that using foreign keys is leaking database-related concerns into the domain. Even using ids seem to be leaking database primary keys into the domain, and yet in
Uncle Bob's case study all the entities have methods for getting/setting an id.
If entities should hold direct references to related entities (as opposed to through foreign key attributes), how should a repository (gateway) go about loading a tree of related entities? Should PostGateway.getLatestTen() also load the User entities for the author attribute of each Post, or should a separate method, PostGateway.getLatestTenWithAuthors(), do that?