sonata-project / SonataAdminBundle

The missing Symfony Admin Generator
https://docs.sonata-project.org/projects/SonataAdminBundle
MIT License
2.11k stars 1.26k forks source link

How to add a custom column to the list? #6488

Closed mikemix closed 3 years ago

mikemix commented 3 years ago

Environment

Docker php:7.3-apache

Sonata packages

Sonata 3.76

Subject

When adding a column to a non existing value:

            ->add('type', null, [
                'label' => 'Type',
                'template' => '@SonataAdmin/CRUD/Cms/list_article_type.html.twig',
            ])

I get:

User Deprecated: Accessing a non existing value is deprecated since sonata-project/admin-bundle 3.67 and will throw an exception in 4.0.

How to do this properly? All I want is to add a custom column to the list.

napestershine commented 3 years ago

You need to define a getter for it in Entity.

VincentLanglet commented 3 years ago

Sorry, but we try to keep github issues for feature requests and bugs only.

And @napestershine gave you the answer