Now that we have our API sending back the comments for each entry on the user's wall, we need to adapt the client code to do two things. First we create a new form and put it beneath each entry so that users can comment on stuff. The second thing we have to do is show the comments made by users beneath each entry. Let's see the following folder structure for the client code:
As usual we need to create an entity to store the data related with a comment. The entity itself is really simple, just a bunch of getters and setters. The only difference now is that we need to store a user entity inside the comment entity that will be the author data.
namespace Wall\Entity; use Zend\Stdlib\Hydrator\ClassMethods; use Users\Entity\User;
These two lines are the namespace and the declaration of the ClassMethod
hydrator we are going to use to populate a User
entity.
class Comment { protected $id = null; protected $user = null; protected $comment = null; protected...