0

I'm using Sonata Admin and I have a question about the inline edition.

I know there is an option ->add('adresse', null, array('editable' => true)) for edit directly in the table all informations.

But in this case, adresse is a text field. How can I do that with, for example an entity field? Example :

        ->add('agent', 'entity', array(
                  'class' => 'CrmBundle:User',
                  'query_builder' => function(EntityRepository $er) {
                       return $er->createQueryBuilder('u')
                                ->where('u.type = ?1 ')
                                ->groupBy('u.id')
                                ->orderBy('u.id', 'ASC')
                                ->setParameters(array(1 => 'Agent'));
                   }
        ))

I need to have the possibility to change entity field directly in the table. Any ideas?

MLavoie
  • 9,671
  • 41
  • 36
  • 56
Clément Andraud
  • 9,103
  • 25
  • 80
  • 158

1 Answers1

0

There is no support for inline editing related entity fields yet. You have to create your custom list field template. In this template you should put the form and javascript code. After the user will edit the field, an ajax request should go to your custom controller, that will store the value to database.

pulzarraider
  • 2,297
  • 19
  • 26