2
votes

I am using Symfony2.6 with Sonata Admin.In my Entity "Order", i have an array column named "Products". this is "ArrayCollection" type and ManyToMany relation with Product Table

How I can show this field in Sonata Admin listMapper.

protected function configureListFields(ListMapper $listMapper)
{
    $listMapper
    ->addIdentifier('id')
    ->add('products')
}

Right now in list It's showing Blank.So How I can show all Products in List Mapper in Order list.

1

1 Answers

1
votes

I think you need to pass service name for products admin in 'admin_code' property. Result should look similar to this:

protected function configureListFields(ListMapper $listMapper)
{
    $listMapper
    ->addIdentifier('id')
    ->add('productProperty', null, array('','admin_code' =>'application.admin.product'))
}