Created
July 9, 2012 12:34
-
-
Save awartoft/3076215 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @author Antoine Hedgecock <[email protected]> | |
*/ | |
/** | |
* @namespace | |
*/ | |
namespace Article\Controller\Admin; | |
use Zend\View\Model\ViewModel, | |
Zend\Mvc\Controller\AbstractActionController; | |
class IndexController extends AbstractActionController | |
{ | |
/** | |
* @return \Article\Service\Article | |
*/ | |
protected function getService() | |
{ | |
return $this->getServiceLocator() | |
->get('article_service'); | |
} | |
public function createAction() | |
{ | |
$vm = new ViewModel(); | |
$vm->setTemplate('article/admin/create'); | |
$form = $this->getServiceLocator() | |
->get('article_form_admin_create'); | |
$obj = new \Article\Entity\Article(); | |
$form->bind($obj); | |
if ($this->getRequest()->isPost()) { | |
//Set the form data.. | |
$form->setData($_POST); | |
if ($form->isValid()) { | |
var_dump($obj); | |
} else { | |
var_dump($form); | |
} | |
} | |
return $vm->setVariable('form', $form); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment