Finally I was able to get the string returning an array from the DataTransformer with an id and a string describing the entity
public function transform($entity)
{
if (null === $entity) {
return "";
}
return array("id" => $entity->getId(), "name" => $entity->__toString());
}
While rendering my custom widget now I can access to those values like this
{% block entity_id_widget %}
{% spaceless %}
<input type="hidden" {{ block('widget_attributes') }} {% if value is not empty %}value="{{ value.id }}" {% endif %}/>
<input class="blocked" autocomplete="off" {% if value is not empty %}value="{{ value.name }}" {% endif %}>
{% endspaceless %}
{% endblock %}