Now that we have the data coming from the API, we can modify the frontend to show the statuses of the user on the wall, and also create a form to allow the users to post new content. In this section, we will see how to include the statuses on the wall, but the important part is focused on how to create forms in ZF2, and how to attach filters and validations to forms.
Before going further, let's see the folder structure in the following screenshot with all the new files and folders we will add in this section of the chapter:
Let's start by writing the code that will show the statuses on the wall. The first thing to do is create an entity for the status. Create a new file in the Entity
folder inside the src
folder of the Wall
module and put the following code inside:
namespace Wall\Entity; use Zend\InputFilter\InputFilter; use Zend\InputFilter\Factory as InputFactory; class Status { protected $id = null; protected $userId = null; protected $status = null...