symfonyorocrmorocommerce

OroPlatform: Custom HTML column on grid


Context

I'm trying to build a custom html column for a custom entity grid. I have searched in the Oro Platform Core to find the right entries for the datagrids.yml

columns:
  id:
    label: ID
    frontend_type: integer
  name:
    label: app.vehicule_type.fields.name
  logo:
    label: app.vehicule_type.fields.logo
    type: twig
    frontend_type: html
    template: BaltimoreAppBundle:Attachment:Datagrid/Property/image.html.twig

BaltimoreAppBundle is my bundle name and image.html.twig is the custom template file.

Issue

OroPlatform/Symfony can't understand my bundle alias BaltimoreAppBundle, so I've got an error.

enter image description here

Any idea why my alias doesn't works ?

Thanks.


Solution

  • First of all, make sure the bundle is registered at the symfony kernel by running:

    php bin/console debug:container --parameter=kernel.bundles --format=json
    

    The key in the output array is the bundle name that should be used for the template path. If it's not, follow the Bundle Creation Guide.

    Then make sure that the path to the template you refer is correct. For the one you use, inside the loaded BaltimoreAppBundle bundle, you should have the template file path: Resources/views/Attachment/Datagrid/Property/image.html.twig.

    If it doesn't help, make sure the application cache is fresh by dropping it, using rm -rf var/cache/*, and regenerating it manually, using php bin/console cache:warmup.