I am trying to make a twitter clone. Thanks to the wonders of MVC, after setting up the models relationships getting related entries has become really simple. For instance, getting all the posts of a single user for the users page is as simple as:
$posts = $user->getPosts();
I have run into a problem when I got to the homepage part where I'm supposed to show all the latest posts of the followed users. I can get all the followed users:
$followers = $user->getFollowers();
But what I need is the next step, all their posts. Something along the lines of:
$posts = $user->getFollowers()->getPosts();
Any help would be much appreciated.