![]() |
|
Snippets |
|
By default, we can't display primary keys in the admin generator edit view.
But I wanted to do just that.
Here is an example for the module/table "article", and the primary key column "id" :
Create a partial "_input_id.php" in the "templates" directory of your module :
<?php echo input_tag('inputId', $article->getId(), array('disabled' => true, 'size'=>10)); ?>
In "config/generator.yml", declare your partial field in the "fields" section to set back the original name of the field, and in the "edit/display" parameter :
generator: class: sfPropelAdminGenerator param: model_class: Article theme: default fields: input_id: {name: id} list: title: Article List edit: display: [_inputId, name]
Beware of the tricky spelling of the partial name in the generator.yml file if, like me, you like underscores...