$form = $this->getServiceLocator()->get('FormElementManager')->get('Blog\Form\Post');
if($this->params()->fromPost()){
$form->setData($this->params()->fromPost());
if($form->isValid()){
$service = $this->getServiceLocator()->get('Blog\Service\Post');
$post = $service->createPost($form->getData());
$this->flashMessenger()->addSuccessMessage($this->translate('Сообщение'));
$this->redirect()->toRoute('blog/post',['post' => $post->getId()]);
}
}
return new ViewModel(['form' => $form]);
ах моя доброта :(
пользуйся=)