Note that there are some explanatory texts on larger screens.

plurals
  1. POFOSUserBundle show group roles in edit view
    primarykey
    data
    text
    <p>I'm trying by overriding the controller and the formtype, to show the roles from the selected group in my view, but I don't find the right way. I've followed the steps to override everything, that works, but problem comes when I try to say to the service that I'm passing to the constructor an entity object.</p> <p>As the formtype has to be overridden, how to pass through the service that you need to implement, my Group entity?</p> <p>Does anyone have an idea of how to achieve that?</p> <p>Here's what I've done:</p> <ol> <li><p>Override the controller, and when creating the Form, pass the <code>$group</code> entity</p> <pre><code>$formFactory = $this-&gt;container-&gt;get('fos_user.group.form.factory'); $form = $formFactory-&gt;createForm($group); //Here </code></pre></li> <li><p>Override the form, and use a custom __construct method where I can pass my entity (maybe here is my error and that should be done in a better or other way)</p> <pre><code>public function __construct(Container $container, Groups $group) { $this-&gt;container = $container; $this-&gt;roles = array_keys($this-&gt;container-&gt;getParameter('security.role_hierarchy.roles')); $this-&gt;group = $group; #How? } </code></pre></li> </ol> <p>The container to get the keys for the roles is passed without errors, that works.</p> <ol start="3"> <li><p>Create the service as the documentation says (here comes the real problem and the exceptions)</p> <pre><code> x_s_cosmos.group.form.type: class: X\S\CosmosBundle\Form\Type\GroupFormType arguments: [@service_container, here_should_be_my_entity?] tags: - { name: form.type, alias: kosmos_group_form } </code></pre></li> </ol> <p>I'm really stacked with that and don't have any idea of how to go on.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload