Outline

Demo: Get Comments From Article

So let's go get some Comments for any given Article. Hopefully I've done this routine enough times that you know that all I'm doing is following the downline chain of methods to get us where we need to be to begin making changes.

Once we make it to the Repository method where we Get Comments for an Article we'll begin implementing the changes.

Let's have the Context grab the Generic List of Commentary including the Author of each Commentary where the Slug of the Commentary's Editorial matches the requested Slug.

Next let's create a new Generic List of Comments which we'll populate by iterating thru the Generic List of Commentaries. By using the mapper we'll map each Commentary to a Comment, each Person to an Author, we'll indicate as to whether the logged in user is following the Author and add it the Generic List of Comments.

Wash, Rinse and repeat until we've gone thru all the Commentaries and return it as an array.

That's it! Another Slam Dunk in the books!

Let's not celebrate just yet. Run it and see if it works.

We don't need to login for this test. We just need to find a Slug we can use to get the Comments.

Finally we can list the comments for the Slug and we're done!

There is one more test you can do to make sure everything is working correctly…

If you're not already following an Author of any Comments you see, go ahead and login so you can follow someone and list the Comments again. Now that you're logged in you should see that it indicates you're following the Author.

This indication is show only when you're logged in.

Next Up, Delete A Comment from an Article. See you there!

 

I finished! On to the next chapter