Skip to content

Latest commit

 

History

History
74 lines (52 loc) · 1.59 KB

09-extended-entity.md

File metadata and controls

74 lines (52 loc) · 1.59 KB

Extended Entity

Topics

  • OroEntityBundle (UI for entities)
  • OroEntityExtendBundle (extend functionality)

Changes

src/Acme/Bundle/TaskBundle
    Resources
        config
            datagrid.yml (updated)
        views
            Task
                view.html.twig (updated)
                update.html.twig (updated)

Making entity extended

  1. Ensure Task entity extends ExtendTask class
class Task extends ExtendTask
  1. Go to System -> Entties and check "Is extend" column for Task

  2. Add field to Task entity

  3. Click "Update schema" button

  4. Update Acme/Bundle/TaskBundle/Resources/config/datagrid.yml

extended_entity_name: %acme_task.entity.class%
  1. Check new field in grid

  2. Update Acme/Bundle/TaskBundle/Resources/views/Task/view.html.twig

{% import 'OroEntityConfigBundle::macros.html.twig' as entityConfig %}
{{ entityConfig.renderDynamicFields(entity) }}
  1. Check view page of Task

  2. Update Acme/Bundle/TaskBundle/Resources/views/Task/update.html.twig

  {% if form.additional is defined and form.additional.children|length > 0 %}
      {% set additionalData = [] %}
      {% for value in form.additional %}
          {% set additionalData = additionalData|merge([form_row(value)]) %}
      {% endfor %}

      {% set dataBlocks = dataBlocks|merge([{
          'title': 'Additional'|trans,
          'subblocks': [{
              'title': '',
              'useSpan': false,
              'data' : additionalData
          }]
      }] ) %}
  {% endif %}
  1. Check form page of Task