So I am developing an application using the Data Mapper design pattern but I am having some problems in handling relationships between database tables. I am not sure, and could not find any resource of how should I map my relations with the Data Mapper pattern.
Should I use referenceMap and dependentTables definitions in my DbTable classes or should I go with composition and instantiate a new class when I need it?
For example a blog post and it's author should be something like:
$blog->author = findDependentRowset($row)
or
$author = new Author();
$blog->author = $author->findAuthorById($authorId);