i was able to find a way to resolve this :
1) override base_list_field in your own bundle ( copy the files in vendor\sonata-project\admin-bundle\Sonata\AdminBundle\Resources\views\CRUD\base_list_field.html.twig in your own bundle like acme/bundle/resources/views/CRUD )
2) modify the file to looks like this :
{#
This file is part of the Sonata package.
(c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
#}
<td class="sonata-ba-list-field sonata-ba-list-field-{{ field_description.type }}" objectId="{{ admin.id(object) }}">
{% if
field_description.options.identifier is defined
and field_description.options.route is defined
and admin.isGranted(field_description.options.route.name == 'show' ? 'VIEW' : field_description.options.route.name|upper, object)
and admin.hasRoute(field_description.options.route.name)
%}
<script type="text/javascript">
var route = "{{ admin.generateObjectUrl(field_description.options.route.name, object, field_description.options.route.parameters) }}";
var url = route.split(/(app)\//);
var tabUrl = url[2].split ( "/" );
alert ( 'test' ) ;
var new_url = '';
// case where adminclass is a child
if ( tabUrl.length == 5 )
{
new_url = url[0] + url[1] + '/' + tabUrl[2] + '/' + tabUrl[3] + '/' + tabUrl[4] ;
}
// case where adminclass is not a child
if ( tabUrl.length == 3 )
{
new_url = "{{ admin.generateObjectUrl(field_description.options.route.name, object, field_description.options.route.parameters) }}";
}
document.write( {%raw%}"<a href='"{%endraw%} + new_url + {%raw%}"'>{%endraw%}{%- block field %}{{ value }}{% endblock -%}{%raw%}</a>"{%endraw%} );
</script>
{% else %}
{{ block('field') }}
{% endif %}
if the tabUrl ( whitch is a split of the url with '/' ) find 5 results , it means that we are in adminclass embedded , otherwise it's a normal admin class listing .
the code is not very clean and optimized but it works .
3) update your config.yml
sonata_admin:
title: Bonk
title_logo: public/img/logo-admin.png
security:
handler: sonata.admin.security.handler.noop
templates:
# default global templates
layout: SonataAdminBundle::standard_layout.html.twig
ajax: SonataAdminBundle::ajax_layout.html.twig
dashboard: SonataAdminBundle:Core:dashboard.html.twig
# default actions templates, should extend a global templates
list: SonataAdminBundle:CRUD:list.html.twig
show: SonataAdminBundle:CRUD:show.html.twig
edit: SonataAdminBundle:CRUD:edit.html.twig
------>>> base_list_field: AcmeMyBundle:CRUD:base_list_field.html.twig
and
sonata_doctrine_orm_admin:
# default value is null, so doctrine uses the value defined in the configuration
entity_manager: '@doctrine.orm.entity_manager'
templates:
form:
- SonataDoctrineORMAdminBundle:Form:form_admin_fields.html.twig
filter:
- SonataDoctrineORMAdminBundle:Form:filter_admin_fields.html.twig
types:
list:
array: SonataAdminBundle:CRUD:list_array.html.twig
boolean: SonataAdminBundle:CRUD:list_boolean.html.twig
date: SonataAdminBundle:CRUD:list_date.html.twig
time: SonataAdminBundle:CRUD:list_time.html.twig
datetime: SonataAdminBundle:CRUD:list_datetime.html.twig
text: acmeMyBundle:CRUD:base_list_field.html.twig
trans: SonataAdminBundle:CRUD:list_trans.html.twig
string: acmeMyBundle:CRUD:base_list_field.html.twig
smallint: acmeMyBundle:CRUD:base_list_field.html.twig
bigint: acmeMyBundle:CRUD:base_list_field.html.twig
integer: acmeMyBundle:CRUD:base_list_field.html.twig
decimal: acmeMyBundle:CRUD:base_list_field.html.twig
identifier: acmeMyBundle:CRUD:base_list_field.html.twig
hope this will help !