0
votes

With Symfony2, i use "FOSuserBundle". In my Entity "Group", i have an array column named "roles". this is "ArrayCollection" type. How to edit this field "roles" with Admin Generator like "Sonata Admin" when i want to create or edit "Group".

I try with "sonata_type_collection" type but no success.

Do you have an example or link who explain how to do this ?

PS: "roles" use "DC2Type:array" in Group table with MySQL.

1

1 Answers

1
votes

WARNING EDIT: I'm not using Sonata anymore, @romain-bruckert comment might be better.


I think that you need to rely on the SonataAdmin field types :

  • array: display value from an array
  • boolean: display a green or red picture dependant on the boolean value, this type accepts an editable parameter to edit the value from within the list or the show actions
  • date: display a formatted date. Accepts an optional format parameter
  • datetime: display a formatted date and time. Accepts an optional format parameter
  • text: display a text
  • trans: translate the value with a provided catalogue option
  • string: display a text
  • decimal: display a number
  • currency: display a number with a provided currency option
  • percent: display a percentage
  • choice: uses the given value as index for the choices array and displays (and optionally translates) the matching value
  • url: display a link

So for your ArrayCollection, an array type might be good.