One of my colleagues has provided the following as a "starting place"
<?php
class TestController extends Zend_Controller_Action
{
public function indexAction()
{
$product_table = ProductPeer::getTableMap();
$product_columns = $product_table->getColumns();
$elements = array();
foreach($product_columns as $col_name => $col_data)
{
$col_name = ucwords(str_replace('_', ' ', strtolower($col_name)));
switch($col_data->getType())
{
case 'TINYINT':
$element = new Zend_Form_Element_Text(
$col_name,
array(
'label' => $col_name
)
);
break;
case 'SMALLINT':
$element = new Zend_Form_Element_Text(
$col_name,
array(
'label' => $col_name
)
);
break;
case 'INTEGER':
$element = new Zend_Form_Element_Text(
$col_name,
array(
'label' => $col_name
)
);
break;
case 'FLOAT':
$element = new Zend_Form_Element_Text(
$col_name,
array(
'label' => $col_name
)
);
break;
case 'DOUBLE':
$element = new Zend_Form_Element_Text(
$col_name,
array(
'label' => $col_name
)
);
break;
case 'VARCHAR':
$element = new Zend_Form_Element_Text(
$col_name,
array(
'label' => $col_name
)
);
break;
case 'DECIMAL':
$element = new Zend_Form_Element_Text(
$col_name,
array(
'label' => $col_name
)
);
break;
case 'LONGVARCHAR':
$element = new Zend_Form_Element_Text(
$col_name,
array(
'label' => $col_name
)
);
break;
case 'DATE':
$element = new Zend_Form_Element_Text(
$col_name,
array(
'label' => $col_name
)
);
break;
case 'TIMESTAMP':
$element = new Zend_Form_Element_Text(
$col_name,
array(
'label' => $col_name
)
);
break;
default:
die("Unknown colum type: " . $col_data->getType());
}
$elements[] = $element;
echo $element;
}
die("END");
}
}