7.3 Admin: Grid Migration

When to Execute

This step is OPTIONAL. Execute only if your plugin defines admin grids.

Overview

Grid definitions remain largely the same in Sylius 2.0. Main changes:

  • Update Sylius template paths (@SyliusAdmin/Grid/... β†’ @SyliusAdmin/shared/grid/...)

  • Verify template paths use lowercase (Grid/Field β†’ grid/field)

  • Replace deprecated entities filter with entity

  • Update icon names (Semantic UI β†’ Tabler)

1. Update Sylius Template Paths

Sylius 2.0 moved templates from @SyliusAdmin/Grid/... to @SyliusAdmin/shared/grid/....

Skip this if:

  • Your plugin doesn't reference Sylius grid templates

  • All your grid templates are custom (from your own plugin)

Update in both YAML grids and PHP Extension:

Before (Sylius 1.x):

After (Sylius 2.0):

Common patterns to update:

  • @SyliusAdmin/Grid/Field/... β†’ @SyliusAdmin/shared/grid/field/...

  • @SyliusAdmin/Grid/Action/... β†’ @SyliusAdmin/shared/grid/action/...

  • @SyliusAdmin/Grid/Filter/... β†’ @SyliusAdmin/shared/grid/filter/...

Note: Custom plugin templates like @YourPlugin/admin/grid/field/custom.html.twig don't need changes.

2. Verify Template References

After updating paths, verify that all referenced templates actually exist in Sylius 2.0 and have correct casing.

Common issues:

Incorrect Casing

Sylius 2.0 uses lowercase paths. Fix any capital letters:

Common patterns:

  • @SyliusUi/Grid/Field/ β†’ @SyliusUi/grid/field/

  • @SyliusAdmin/Grid/ β†’ @SyliusAdmin/grid/ or @SyliusAdmin/shared/grid/

Template No Longer Exists

Some Sylius templates may have been removed in 2.0. To check if a template exists:

If not found, create a custom template in your plugin.

3. Restore Custom Grid Templates

If your grid configuration references custom templates, restore them from backup with proper snake_case naming.

Important: Directory names must use snake_case in Sylius 2.0:

  • Admin/Grid/Field β†’ admin/grid/field

  • Admin/Resource/Grid β†’ admin/resource/grid

Steps:

  1. Check your grid configuration for custom template references in config/grids/*.yaml or src/DependencyInjection/*Extension.php

  2. Find templates in old_templates/ and restore them with snake_case paths:

  3. Update grid configuration to use snake_case paths:

4. Update Deprecated entities Filter

The experimental entities filter has been removed. Replace it with entity:

Key changes:

  • Filter type: entities β†’ entity

  • Option: field: "value" β†’ fields: [value] (string to array)

5. Update Icons to Tabler Format

Update icon format to use tabler: prefix:

Find icon names at: https://ux.symfony.com/icons

6. Validate

Clear cache and check if grids work:

Visit your admin grid pages and verify:

  • Grid displays correctly

  • Filters work (especially if you changed entities β†’ entity)

  • Actions have correct Tabler icons

  • Pagination works

Common Issues

Template not found errors

Problem: Error about missing @SyliusAdmin/Grid/... or @SyliusAdmin/shared/grid/... templates.

Solution: Most Sylius grid templates still exist in the new version at @SyliusAdmin/shared/grid/..., but some were removed. If a template was removed, you need to create your own.

Recommended path for custom templates:

Examples:

  • templates/catalog_promotion/grid/action/delete.html.twig

  • templates/product/grid/field/image.html.twig

  • templates/order/grid/filter/channel.html.twig

Replace {resource}, {type} (action/field/filter), and {name} with your specific values.

Last updated

Was this helpful?