[…]
use Zend\Stdlib\Hydrator\ClassMethods as ClassMethodsHydrator;
use Zend\Db\ResultSet\HydratingResultSet;

class ResultSetFactory implements FactoryInterface 
{
	public function createService(ServiceLocatorInterface $serviceLocator) 
	{
		$rowObject = new \Application\Entity\Status();
		return new HydratingResultSet(new ClassMethodsHydrator(), $rowObject);
	}
}

[…]
class StatusTableFactory implements FactoryInterface 
{
	public function createService(ServiceLocatorInterface $serviceLocator) 
	{
		$dbAdapter = $serviceLocator->get('Zend\Db\Adapter\Adapter');
		$resultSet = $serviceLocator->get('Application\Model\ResultSet');
		return new StatusTable($dbAdapter, $resultSet);
	}
}

public function indexAction()
{
	$service = $this->getServiceLocator()->get(‘Application\Model\StatusTable’);
	$statuses = $service->fetchAll();
	return array(‘statuses’ => $statuses);
}

<table class="table table-striped »>
[…]
<tbody>
	<?php foreach ($this->statuses as $status): ?>
	<tr>
		<td><?php echo $status->getId(); ?></td>
		<td><?php echo $status->getUser(); ?></td>
		<td><?php echo $status->getMessage(); ?></td>
		<td><?php echo (new \DateTime($status->getCreatedAt()))->format('d/m/Y H:i'); ?></td>
		<td>
			<a href="<?php echo $this->url('status', array('id' => $status->getId(), 'action' => 'update')); ?>" class="btn btn-default"><i class="glyphicon glyphicon-edit"></i></a>
			<a href="<?php echo $this->url('status', array('id' => $status->getId(), 'action' => 'delete')); ?>" class="btn btn-danger"><i class="glyphicon glyphicon-trash"></i></a>
		</td>
	</tr>
	<?php endforeach; ?>
</tbody>
</table>

public function __construct()
{
	parent::__construct('status');
	$this->setAttribute('role', 'form');

	$this->add(array(
		'name' => 'id',
		type' => 'hidden',
	));

	$this->add(array(
		'name' => 'user',
		'type' => 'text',
		'options' => array(
			'label' => 'User',
			'label_attributes' => array('class' => 'control-label col-sm-2'),
		),
		'attributes' => array(
			'class' => 'form-control',
			'placeholder' => 'User pseudo',
		),
	));
}

'form_elements' => array(
	'invokables' => array(
		'form.status' => 'Application\Form\Status',
	),
),

public function indexAction()
{
	$statuses = $this->getStatusTable()->fetchAll();
	$form = $this->getServiceLocator()->get('FormElementManager')->get('form.status');
		
	return compact('form', 'statuses');
}

/**
 * 
 * @var Application\Model\StatusTable
 */
protected $statusTable;
	
protected function getStatusTable()
{
	if (null === $this->statusTable) {
		$this->statusTable = $this->getServiceLocator()->get('Application\Model\StatusTable');
	}
	
	return $this->statusTable;
}

<?php 
$form = $this->form;
$form->prepare();

<?php echo $this->form()->openTag($form); ?>
<?php echo $this->formhidden($form->get('id')); ?>
<table class="table table-striped">
[...]
		<tr>
			<td>&nbsp;</td>
			<td><?php echo $this->formtext($form->get('user')); ?></td>
			<td><?php echo $this->formtext($form->get('message')); ?></td>
			<td><?php echo $this->formhidden($form->get('csrf')); ?>/td>
			<td><?php echo $this->formsubmit($form->get('submit')); ?></td>
		</tr>
	</tbody>
</table>
<?php echo $this->form()->closeTag($form); ?>

public function indexAction()
{
	if (($prg = $this->prg()) instanceof Response ) {
		return $prg;
	} 
	
	$statuses = $this->getStatusTable()->fetchAll();
	$form = $this->getServiceLocator()->get('FormElementManager')->get('form.status');
	
	if ( false !== $prg ) {
		$form->setData($prg);
		$this->getStatusTable()->saveStatus($form->getData());
		$this->flashMessenger()->addSuccessMessage('User\'s status successfully created');
		$this->redirect()->toRoute(‘status’)->setStatusCode(303);
	}
	
	return compact('form', 'statuses');
}

public function getInputFilterSpecification()
{
	return array(
		'user' => array(
			'required' => true,
			'validators' => array(
				array(
					'name' => 'InArray',
					'options' => array(
						'haystack' => array('jguittard', 'jdoe'),
					),
				),
			),
		),
		'message' => array(
			'required' => true,
			'filters' => array(
          			array(
					'name' => 'StringTrim'
				),
          			array(
					'name' => 'StripTags'
				),
          		),
			'validators' => array(
				array(
					'name' => 'StringLength',
					'options' => array(
						'min' => 3,
						'max' => 140,
					),
				),
			),
		),
	);
}

$form->setData($prg);
if ($form->isValid()) {
	$this->getStatusTable()->saveStatus($form->getData());
	$this->flashMessenger()->addSuccessMessage('User\'s status successfully created');
	$this->redirect()->toRoute(‘status’)->setStatusCode(303);
}

<h1 class="page-header"><?php echo $title; ?></h1>
<div class="alert alert-danger">
<ul>
<?php foreach ($form->getMessages() as $input => $errors): ?>
<li>
<?php foreach ($errors as $key => $value): ?>
<strong><?php echo ucfirst($input)?></strong> : <?php echo $value; ?>
<?php endforeach; ?>
</li>
<?php endforeach; ?>
</ul>
</div>
<?php endif; ?>