Skip to content

Latest commit

 

History

History
144 lines (114 loc) · 4.06 KB

migrate-from-1x-to-2x.md

File metadata and controls

144 lines (114 loc) · 4.06 KB

Migration from 1.x to 2.x

If you've installed EasyAdminPlus v1.x and you want to upgrade to 2.x, follow this quick guide.

Bundle Upgrade

// composer.json
{    
    "require": {
        // ...
        "wandi/easyadmin-plus-bundle": "^2.0",
        // ...
    }
}
> composer update wandi/easyadmin-plus-bundle

EasyAdmin Configuration Update - ACL

Before

EasyAdminPlusBundle 1.x implementeded entity/action role permissions thanks to the role attribute.

# config/packages/entities/{entity}.yaml
easy_admin:
    entities:
        Product:
            class: App\Entity\Product
            list:
                role: ['ROLE_EASY_ADMIN_SUPER']
                # ...

After

Sadly EasyAdminBundle introduced this feature with to the item_permission attribute.

# config/packages/entities/{entity}.yaml
easy_admin:
    entities:
        Product:
            class: App\Entity\Product
            list:
                item_permission: ['ROLE_EASY_ADMIN_SUPER']
                # ...

Search in all your EasyAdmin configuration files (config/packages/easy_admin/ directory) for role: occurrences and just replace them by item_permission:

PhpStorm Replace

EasyAdmin Configuration Update - Boostrap

EasyAdminBundle 2.x upgraded Bootstrap to version 4 and deleted the vertical form_theme.

Before

# config/packages/entities/{entity}.yaml
easy_admin:
    entities:
        Article:
            class: App\Entity\Article
            list:
                fields: 
                    - { type: 'group', css_class: 'col-sm-6', label: 'Infos', icon: 'info-circle' }
                    - { property: title, css_class: 'col-sm-6', label: 'Title' }
                    - { property: slug, css_class: 'col-sm-6', label: 'Slug' }
                    - { type: 'group', label: 'NB', icon: 'bar-chart' }
                    - { property: nbLikes, css_class: 'col-sm-4', label: 'NB Likes', type_options: { disabled: true } }
                    - { property: nbComments, css_class: 'col-sm-4', label: 'NB Comments', type_options: { disabled: true } }
                    - { property: nbShares, css_class: 'col-sm-4', label: 'NB Shares', type_options: { disabled: true } }
                    # ...

After

# config/packages/entities/{entity}.yaml
easy_admin:
    entities:
        Article:
            class: App\Entity\Article
            list:
                fields: 
                    - { type: 'group', columns: 6, label: 'Infos', icon: 'info-circle' }
                    - { property: title, columns: 6, label: 'Title' }
                    - { property: slug, columns: 6, label: 'Slug' }
                    - { type: 'group', label: 'NB', icon: 'bar-chart' }
                    - { property: nbLikes, columns: 4, label: 'NB Likes', type_options: { disabled: true } }
                    - { property: nbComments, columns: 4, label: 'NB Comments', type_options: { disabled: true } }
                    - { property: nbShares, columns: 4, label: 'NB Shares', type_options: { disabled: true } }
                    # ...

Search in all your EasyAdmin configuration files (config/packages/easy_admin/ directory) for css_class: 'col-sm-(\d?)' occurrences and just replace them by columns: $1

PhpStorm Replace

EasyAdmin Configuration Update - Design

If you used the vertical form_theme, simply remove it, you can still use flex grid with the columns attribute (see above)

Before

# config/packages/easy_admin/design.yaml
easy_admin:
    # ...
    design:
        form_theme:
            - 'vertical'
    # ...

After

# config/packages/easy_admin/design.yaml
easy_admin:
    # ...
    design:
        form_theme:
            #- 'vertical'
            # other form_themes...
    # ...

And that's it!


Next chapter: Chapter 1 - Authentication