简体   繁体   中英

Display primary key Sonata Admin bundle

I am using Sonata Admin Bundle and Sumfony 2.3.3. I have a Product table and a Brand table. The brand id is put in product table. Now when I display the product table, I need to display the Brand name instead of the brand id, and that should come from the brand table. How can i do this? Please help me. Thanks

protected function configureListFields(ListMapper $listMapper)
{
    $listMapper
        ->addIdentifier('product_id')
        ->add('product_name')
        ->add('brand_id')
    ;
}

我认为这可以工作: $listMapper->add('brand.name');

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM