Criação de controladora utilizando o projeto Mimoza. Construtor de controladoras e visualização com somente a ação padrão.

Esse commit está contido em:
wandersonwhcr
2010-07-29 00:01:08 +00:00
commit 0c44835b69
3 arquivos alterados com 92 adições e 0 exclusões
+3
Ver Arquivo
@@ -152,6 +152,9 @@ class Mimoza extends Module implements Module_Interface
*/
public function applyCRUD($entity)
{
$name = ucfirst(strtolower($entity->name));
$controller = $this->getProject()->buildController($entity);
$this->getFramework()->mkFile("project/application/controllers/{$name}Controller.php", $controller);
return $this;
}
@@ -0,0 +1,17 @@
<?php
/**
*
* Construtor de Controladoras do Sistema
* @author Wanderson Henrique Camargo Rosa
*
*/
class Builder_Controller extends Mimoza_Builder
{
public function build($element)
{
$this->author = $this->getProject()->getMindProject()->owner;
$this->name = ucfirst(strtolower($element->name));
return $this->render('controller.phtml');
}
}
@@ -0,0 +1,72 @@
[php]
/**
*
* Controladora de <?php echo $this->name ?>
* Mind Module for Zend Framework Applications (Mimoza)
* @author <?php echo $this->author ?>
* @see http://code.google.com/p/webmind/Mimoza
* @package Application
* @subpackage Controller
*/
class <?php echo $this->name ?>Controller extends Zend_Controller_Action
{
/**
*
* @var Application_Model_DbTable_<?php echo $this->name ?>
*/
protected $_table = null;
/**
*
* @var Application_Form_<?php echo $this->name ?>
*/
protected $_form = null;
/**
*
* @return Application_Model_DbTable_<?php echo $this->name ?>
*/
public function getTable()
{
if (is_null($this->_table)) {
$this->_table = new Application_Model_DbTable_<?php echo $this->name ?>();
}
return $this->_table;
}
/**
*
* @return Application_Form_<?php echo $this->name ?>
*/
public function getForm()
{
if (is_null($this->_form)) {
$this->_form = new Application_Form_<?php echo $this->name ?>();
}
return $this->_form;
}
/**
*
* @return void
*/
public function init()
{
$this->view->headTitle('<?php echo $this->name ?>');
}
/**
*
* @return void
*/
public function indexAction()
{
$table = $this->getTable();
$order = $this->_getParam('order', null);
$select = $table->select()->order($order);
$result = $table->fetchAll($select);
$this->view->result = $result;
}
}