These are chat archives for symfony2admingenerator/GeneratorBundle

7th
Apr 2015
Matej Velikonja
@matejvelikonja
Apr 07 2015 12:45
another question from my side: I've created Store entity which has many Brand entity. The editing of Brand will be handled by different controller. What I would like is just to have ability on Store entity to add Brand to it via some kind of dropdown or something. Is this supported out-of-the-box by bundle?
ioleo
@ioleo
Apr 07 2015 13:01
thanks :)
@matejvelikonja you can use FormExtensionsBundle s2a_bootstrap_collection + s2a_select2_entity to handle this case
it's just like regular symfony2 collection of entity types, BUT it handles all the Javascript Add/Remove (and CSS design) stuff for you
Matej Velikonja
@matejvelikonja
Apr 07 2015 13:07
i've noticed. what;s the differemnce between s2a_select2_entity and s2a_double_list_entity
Matej Velikonja
@matejvelikonja
Apr 07 2015 13:20
@loostro ok. one more question? are many2many relationship supported? should work easily?
Christian Schulze
@lucarnu
Apr 07 2015 14:23

Hi! I would be glad about discussing 2 little questions for issue #82 :

(1) At first I am not sure about to store the information for a group and the credential expression belonging to the group (for each: add/edit/list/show). I would suggest to create a yaml config file during bundle generation process to store the information for every admin config.

(2) In the next step I would use a data provider service to load the groups from the corresponding config , evaluate them and return the allowed groups. So I would be able to exclude the data from controller and start a centralized service. Do I am right by implementing it this way?

ioleo
@ioleo
Apr 07 2015 15:12
@matejvelikonja select2_entity uses Bootstrap Select2 :) double_list_entity is our own widget, very simple... it displays 2 lists ("selected" and "not selected") and you can move items left/right (from one list to another) to "select or unselect" that item... its only good for simple short lists
yes ManyToMany is supported, however you must make sure that the owning side is updated
eg. if you have Products -> manyToMany -> Categories, one side is the owning, the other is the inverse side of relation
to make sure the change is persisted
ioleo
@ioleo
Apr 07 2015 15:25
@lucarnu currently the generated controller return an empty array see here for groups, and it is up to you to overwrite this with your custom logic in your bundle's controller (the one that extends the base controller)
to get what you proposed, you could overwrite the templates by adding files to app/Resources/AdmingeneratorGeneratorBundle/templates/....
I agree that haveing groups outside of controller, in a seperate service/class, would be really good (slimmer controller :+1:)
i feel like we could add to generator.yml one parameter: groups_service which would require a fully qualified class name, eg Acme/DemoBundle/Groups/User
ioleo
@ioleo
Apr 07 2015 15:30
the class would have to implement an interface GroupsProvider (which we would create in admingenerator repository)
the inferface should be simple -> just one method get($builder, $field)
which returns an array of strings, eg. ["Admin", "Manager"]
we could also create some BaseGroupsProvider with some helper methods to speed up creating new providers
and just like that, you could create in your bundle a class class MyGroupsProvider implements GroupsProvider which holds the logic you proposed in #86 and then simply in all your generator.yml you could link to the same class
ioleo @loostro just added s2a_daterange_picker to FormExtensionsBundle... testing now :)
ioleo
@ioleo
Apr 07 2015 16:14
heheh i knew ill forget something ;)
service definition is missing :p
ioleo
@ioleo
Apr 07 2015 21:23
@ksn135 looks like s2a_daterange_picker is working, i just need to tweak the default options
ioleo
@ioleo
Apr 07 2015 23:35
@ksn135 finished :) just tagged v2.0-beta.13 on FormExtensionsBundle