有的时候数据库中的table,有N个字段,但是在新建、修改的时候我们只要求用户创建或者修改其中的几个字段。如果不设置generator.yml和form,系统默认会显示所有,更新所有。
generator.yml
edit:
display: [ name, romaji, color, ordernum, state]
new:
display: [ name, romaji, color, ordernum state]
根目录lib\form\对应的form文件
public function configure()
{
//设置字段hidden
$this->setWidget('ordernum', new sfWidgetFormInputHidden());
//设置字段默认值
$this->setDefault('ordernum', 1);
}
actions:
yyy: //名字
label: xxxxx //显示的名字
action: yyyyy //触发的动作
如果不想拥有任何的操作动作,可以这样配置
actions: [ ]
batch_actions:
xxx: //名字
label: xxxxx //显示的名字
action: yyyyy //触发的动作
如果不想拥有任何的操作动作,可以这样配置
batch_actions: [ ]
_assets.php 设置CSS
_filters.php 过滤器显示
_filters_field.php 过滤器内容显示
_flashes.php
_form.php form new edit表格
_form_actions.php form 对应的相应动作,在表格的最下面
_form_field.php form内容显示
_form_fieldset.php form显示
_form_footer.php 表格尾信息
_form_header.php 表格头信息
_list.php list显示列表
_list_actions.php list 显示在table外面的动作,new的位置
_list_batch_actions.php list batch动作 下拉框的那个动作
_list_field_boolean.php image??
_list_footer.php list 尾信息
_list_header.php list 头信息
_list_td_actions.php 显示配置里面的object_actions
_list_td_batch_action.php 前面的checkbox框
_list_td_stacked.php
_list_td_tabular.php
_list_th_stacked.php
_list_th_tabular.php 对应配置里面的list -> display
_pagination.php 翻页
editSuccess.php 对应edit动作 里面会调用edit局部模板
indexSuccess.php 对应默认index动作
newSuccess.php 对应new动作 里面会调用form局部模板