Código PHP:
class ArtistaController extends Zend_Controller_Action{
public $foo;
public function init(){
$this->initView();
$this->view->baseUrl = $this->_request->getBaseUrl();
}
public function addAction(){
$this->view->title = "Agregar artista";
$this->view->headTitle($this->view->title);
$form = new Application_Form_Artista ();
$form->submit->setLabel('Add');
$this->view->form = $form;
if ($this->getRequest()->isPost()){
$formData = $this->getRequest()->getPost();
if ($form->isValid($formData)){
// $artista_id = $form->getValue('artista_id');
$nombre = $form->getValue('nombre');
$fecha_ingreso = $form->getValue('fecha');
$descripcion = $form->getValue('descripcion');
$email = $form->getValue('email');
//cambio formato de fecha para mysql
$fecha = $this->fechaMysql($fecha);
$artista = new Application_Model_DbTable_Artista ();
$artista->agregar($nombre, $descripcion, $email, $fecha_ingreso);
$this->_helper->redirector('index');
}
else{
$form->populate($formData);
}
}
$this->foo = 'sd';
}
public function indexAction(){
$table = new Application_Model_DbTable_Artista();
$this->view->datos = $table->listar();
$this->view->name = $this->foo;
}