Edit primary keys in Symfony auto-generated admin
I need to edit primary keys in several tables.
By default, symfony hides primary keys in New/Edit forms.
For example, can't edit table 'Tag开发者_StackOverflow中文版s' with only field 'tag' which is PK. Adding integer ID to this table is not exactly good db design.
Thanks in advance for your help.
As you say, by "default" symfony hides the primary keys.
As such, you will need to modify the generator.yml to include the specific fields you need, and possibly force the type of the fields to 'text' so they do not render as 'plain'.
If this doesn't work, you can always extend the generator.yml to include pseudo fields for these primary key fields.
As an aside, integer auto-increment primary keys are very useful, and the general feeling is against you :)
As stated by @Raise, the simple solution to this is to create an updatable 'ID' field to work alongside the primary key field which you can leave well alone.
精彩评论