Skip to content

Latest commit

 

History

History
341 lines (281 loc) · 17.8 KB

CHANGELOG-1.1.md

File metadata and controls

341 lines (281 loc) · 17.8 KB

CHANGELOG for 1.1 (and 2.0)

This document describes all the significant changes made between 1.0 and 1.1 branches. It also covers transition to 2.0 branch, since 1.1 and 2.0 are backwards compatibile.

Admin elements' changes

Architectural changes

Splitting monolithic CRUD

The major change in admin-bundle's architecture is splitting one monolithic FSi\Bundle\AdminBundle\Admin\CRUD\CRUDInterface into a couple of smaller, more specialized interfaces of admin elements:

These interfaces have been combined again into FSi\Bundle\AdminBundle\Admin\CRUD\CRUDElement which behaves exactly as the old one FSi\Bundle\AdminBundle\Admin\CRUD\CRUDInterface to ease the upgrade process.

New batch element

This element was created to allow performing of repeatable operations on items selected by user on the list. Please refer to the full description of how to use such an admin element. The first general use case of such an operation is deleting selected items, which is implemented as a batch admin element. Other examples are activating/deactivating selected users, turning on/off visibility of selected articles, moving selected articles to the archive, etc. New batch elements can be simply linked to the list element using batch column options in datagrid.

New display element

Brand new FSi\Bundle\AdminBundle\Admin\Display\Element has been introduced and it creates a specialized display object for a single item. This object is used to show selected properties of an item (entity) in a standardized way.

Consequences

Thanks to the introducing of smaller admin elements it's now possible to build more complicated administration interfaces with several different forms and/or displays for one type of item/entity. These different forms and/or displays can be i.e. separately secured for different user roles.

Creation and editing of an item was previously handled by two different actions and their templates, but since one admin list element can be linked to more than one form, such a separation is no longer necessary. The "add" button can simply link to different form element than "edit" button.

Functional changes

Admin element registration

There is a new and easier way of registering admin elements by marking them with @Admin\Element annotation. If you wish to set custom options for admin element using this method you have to do this in setDefaultOptions() through $resolver->setDefaults().

No confirmation during delete

Deleting of selected items no longer display intermediate action with confirmation form. Such a confirmation can be added by attaching some JS to the "Ok" button which performs selected batch action.

Admin menu building

Method getName() was removed from all admin elements. Previously it was used only during building of the admin menu. Now admin menu is built using additional configuration file as described here.

Options changes

Removed options

The following options were removed from FSi\Bundle\AdminBundle\Admin\CRUD\AbstractCRUD

  • menu - removed from all admin elements in favour of new method of menu building method
  • allow_edit - removed because there is no longer any specific "edit" action
  • crud_list_title - removed in favour of header block in list template
  • crud_create_title - removed in favour of header block in form template
  • crud_edit_title - removed in favour of header block in form template
  • template_crud_delete - removed because delete action has no longer any intermediate confirmation action

Added options

  • template_list - template for the list action, its default value is taken from deprecated template_crud_list option
  • template_form - template for the form action, its default value is taken from deprecated template_crud_edit option

Deprecated options

  • template_crud_list - will be removed in favor of template_list
  • template_crud_edit - will be removed in favor of template_form
  • template_crud_create - will be removed in favor of template_form

Important! - if you are using both template_crud_create and template_crud_edit, please note that they have to have the same value since there are no longer different contexts handling creation and update of an item.

Templates changes

Removed templates

  • Resources/views/CRUD/List/*.html.twig - these were the rarely used partials included by Resources/views/CRUD/list.html.twig. Since there are gone, overwriting them in app/Resources has no longer any effect and Resources/views/CRUD/list.html.twig should be overwritten instead.
  • Resources/views/CRUD/delete.html.twig - it is no longer needed since there is no longer any confirmation step while deleting selected items.

Changed templates

  • Resources/views/CRUD/list.html.twig - it extends Resources/views/List/list.html.twig. Since batch actions are added thought datagrid batch column's options, there are no longer batch_action and batch_form blocks to overwrite. There is a new block batch_actions containing the whole batch action selection form.
  • Resources/views/CRUD/edit.html.twig - was removed in favour of Resources/views/CRUD/form.html.twig and overwriting it in app/Resources has no longer any effect.
  • Resources/views/CRUD/create.html.twig - was removed in favour of Resources/views/CRUD/form.html.twig and overwriting it in app/Resources has no longer any effect.
  • Resources/views/Form/form_div_layout.html.twig - was renamed to Resources/views/Form/form_theme.html.twig.

Contexts' changes

Contexts handlers are more generic

All contexts and handlers classes which previously existed in FSi\Bundle\AdminBundle\Doctrine\Context namespace have been removed in favour of new generic (non doctrine-dependent) contexts and handlers in FSi\Bundle\AdminBundle\Admin\CRUD\Context namespace.

Event names changes

Since contexts are rebuild from scratch the naming of events has been also changed.

1.0.* ~1.1
constant name constant name
CRUDEvents::CRUD_LIST_CONTEXT_POST_CREATE'admin.crud.list.context.post_create' --
CRUDEvents::CRUD_LIST_DATASOURCE_REQUEST_PRE_BIND'admin.crud.list.datasource.request.pre_bind' ListEvents::LIST_DATASOURCE_REQUEST_PRE_BIND'admin.list.datasource.request.pre_bind'
CRUDEvents::CRUD_LIST_DATASOURCE_REQUEST_POST_BIND'admin.crud.list.datasource.request.post_bind' ListEvents::LIST_DATASOURCE_REQUEST_POST_BIND'admin.list.datasource.request.post_bind'
CRUDEvents::CRUD_LIST_DATAGRID_DATA_PRE_BIND'admin.crud.list.datagrid.data.pre_bind' ListEvents::LIST_DATAGRID_DATA_PRE_BIND'admin.list.datagrid.data.pre_bind'
CRUDEvents::CRUD_LIST_DATAGRID_DATA_POST_BIND'admin.crud.list.datagrid.data.post_bind' ListEvents::LIST_DATAGRID_DATA_POST_BIND'admin.list.datagrid.data.post_bind'
CRUDEvents::CRUD_LIST_DATAGRID_REQUEST_PRE_BIND'admin.crud.list.datagrid.request.pre_bind' ListEvents::LIST_DATAGRID_REQUEST_PRE_BIND'admin.list.datagrid.request.pre_bind'
CRUDEvents::CRUD_LIST_DATAGRID_REQUEST_POST_BIND'admin.crud.list.datagrid.request.post_bind' ListEvents::LIST_DATAGRID_REQUEST_POST_BIND'admin.list.datagrid.request.post_bind'
CRUDEvents::CRUD_LIST_RESPONSE_PRE_RENDER'admin.crud.list.response.pre_render' ListEvents::LIST_RESPONSE_PRE_RENDER'admin.list.response.pre_render'
CRUDEvents::CRUD_CREATE_CONTEXT_POST_CREATE
CRUDEvents::CRUD_EDIT_CONTEXT_POST_CREATE
'admin.crud.create.context.post_create'
'admin.crud.edit.context.post_create'
--
CRUDEvents::CRUD_CREATE_FORM_REQUEST_PRE_SUBMIT
CRUDEvents::CRUD_EDIT_FORM_REQUEST_PRE_SUBMIT
admin.crud.create.form.request.pre_submit'
'admin.crud.edit.form.request.pre_submit'
FormEvents::FORM_REQUEST_PRE_SUBMIT'admin.form.request.pre_submit'
CRUDEvents::CRUD_CREATE_FORM_REQUEST_POST_SUBMIT
CRUDEvents::CRUD_EDIT_FORM_REQUEST_POST_SUBMIT
'admin.crud.create.form.request.post_submit'
'admin.crud.edit.form.request.post_submit'
FormEvents::FORM_REQUEST_POST_SUBMIT'admin.form.request.post_submit'
CRUDEvents::CRUD_CREATE_ENTITY_PRE_SAVE
CRUDEvents::CRUD_EDIT_ENTITY_PRE_SAVE
'admin.crud.create.entity.pre_save'
'admin.crud.edit.entity.pre_save'
FormEvents::FORM_DATA_PRE_SAVE'admin.form.data.pre_save'
CRUDEvents::CRUD_CREATE_ENTITY_POST_SAVE
CRUDEvents::CRUD_EDIT_ENTITY_POST_SAVE
'admin.crud.create.entity.post_save'
'admin.crud.edit.entity.post_save'
FormEvents::FORM_DATA_POST_SAVE'admin.form.data.post_save'
CRUDEvents::CRUD_CREATE_RESPONSE_PRE_RENDER
CRUDEvents::CRUD_EDIT_RESPONSE_PRE_RENDER
'admin.crud.create.response.pre_render'
'admin.crud.edit.response.pre_render'
FormEvents::FORM_RESPONSE_PRE_RENDER'admin.form.response.pre_render'
CRUDEvents::CRUD_DELETE_CONTEXT_POST_CREATE'admin.crud.delete.context.post_create' --
CRUDEvents::CRUD_DELETE_FORM_PRE_SUBMIT'admin.crud.delete.form.pre_submit' BatchEvents::BATCH_REQUEST_PRE_SUBMIT'admin.batch.request.pre_submit'
CRUDEvents::CRUD_DELETE_FORM_POST_SUBMIT'admin.crud.delete.form.post_submit' BatchEvents::BATCH_REQUEST_POST_SUBMIT'admin.batch.request.post_submit'
CRUDEvents::CRUD_DELETE_ENTITIES_PRE_DELETE'admin.crud.delete.entities.pre_delete' BatchEvents::BATCH_OBJECTS_PRE_APPLY'admin.batch.objects.pre_apply'
CRUDEvents::CRUD_DELETE_ENTITIES_POST_DELETE'admin.crud.delete.entities.post_delete' BatchEvents::BATCH_OBJECTS_POST_APPLY'admin.batch.objects.post_apply'

Additional notes:

  • since there are no different events when creating and editing of an item you should distinguish these two situations by examining $event->getForm()->getData() in your event handler.
  • since all batch events are common for all batch actions (i.e. not only delete), you should identify the action being performed by examining the class of $event->getElement() in your event handler.

Bundle configuration changes

Configuring admin menu

Admin menu is read from %kernel.project_dir%/config/admin_menu.yml by default but the path to menu file can be changed by setting fsi_admin.menu_config_path configuration option.

Configuring language switch

If you want your admin to be multilingual you must set the array of supported locales in fsi_admin.locales configuration option.

Removed configuration options

The following bundle configuration options have been removed due to removal of their underlying functionality:

  • fsi_admin.display_language_switch
  • fsi_admin.templates.crud_create
  • fsi_admin.templates.crud_edit was renamed to fsi_admin.templates.crud_form
  • fsi_admin.templates.crud_delete
  • fsi_admin.templates.edit_form_theme
  • fsi_admin.templates.create_form_theme
  • fsi_admin.templates.delete_form_theme
  • fsi_admin.templates.resource_form_theme

Routing changes

The following old routes have been marked deprecated and redirected to the new routes

  • fsi_admin_crud_list -> fsi_admin_list
  • fsi_admin_crud_create -> fsi_admin_form
  • fsi_admin_crud_edit -> fsi_admin_form
  • fsi_admin_crud_delete -> fsi_admin_batch

Removed classes and interfaces

Old interface/class/namespaceNew interface/class/namespace
FSi\Bundle\AdminBundle\Doctrine\Admin\Context FSi\Bundle\AdminBundle\Admin\CRUD\Context
FSi\Bundle\AdminBundle\Admin\Doctrine FSi\Bundle\AdminBundle\Doctrine\Admin
FSi\Bundle\AdminBundle\Admin\Context\ContextManagerInterface FSi\Bundle\AdminBundle\Admin\Context\ContextManager
FSi\Bundle\AdminBundle\Controller\CRUDController FSi\Bundle\AdminBundle\Controller\ListController, FSi\Bundle\AdminBundle\Controller\FormController, FSi\Bundle\AdminBundle\Controller\BatchController
FSi\Bundle\AdminBundle\Menu\MenuBuilder FSi\Bundle\AdminBundle\Menu\Builder

Deprecated classes and interfaces

Old interface/class/namespaceNew interface/class/namespace
FSi\Bundle\AdminBundle\Admin\ElementInterface FSi\Bundle\AdminBundle\Admin\Element
FSi\Bundle\AdminBundle\Admin\CRUD\CRUDInterface FSi\Bundle\AdminBundle\Admin\CRUD\CRUDElement
FSi\Bundle\AdminBundle\Admin\CRUD\DataGridAwareInterface, FSi\Bundle\AdminBundle\Admin\CRUD\DataSourceAwareInterface FSi\Bundle\AdminBundle\Admin\CRUD\ListElement
FSi\Bundle\AdminBundle\Admin\CRUD\FormAwareInterface FSi\Bundle\AdminBundle\Admin\CRUD\FormElement
FSi\Bundle\AdminBundle\Admin\ResourceRepository\ResourceInterface, FSi\Bundle\AdminBundle\Admin\ResourceRepository\AbstractResource FSi\Bundle\AdminBundle\Admin\ResourceRepository\Element
FSi\Bundle\AdminBundle\Doctrine\Admin\CRUDInterface FSi\Bundle\AdminBundle\Doctrine\Admin\Element
FSi\Bundle\AdminBundle\Doctrine\Admin\DoctrineAwareInterface FSi\Bundle\AdminBundle\Doctrine\Admin\Element