Uploaded image for project: 'Magnolia'
  1. Magnolia
  2. MAGNOLIA-3703

When implementing EarlyExecutionAware, execute() is never called

    XMLWordPrintable

Details

    Description

      If a model class does not implement EarlyExecutionAware, its execute() method is called, before rendering, if a mgnlModelExecutionUUID parameter is passed. It is, correctly, not executed a second at the time of rendering.

      If a model class implements EarlyExecutionAware, its executeEarly() method is called, appropriately, before rendering happens. Its setParent() method is also called, just before rendering, to "re-integrate" the early executed model with its now-executed parent. However, since this class also implements the regular RenderingModel model interface, I would expect its execute() to be called at rendering time. This is especially critical when a model extends a "regular" model class, but additionally implements EarlyExecutionAware – The subclass should not have to remember to call its superclass's execute() method in its executeEarly() method - and it would have to "cancel" its own execute() method.

      I'd rather have "business logic of a paragraph" in my executeEarly() method, and stuff to "prepare" rendering (fetching content, ...) in execute().

      I see one possible problem with this approach though: executeEarly() "Can return a string which is passed #determineTemplatePath" - what do we do in case both executeEarly() and execute() returned a non-null and different value ?

      Checklists

        Acceptance criteria

        Attachments

          Issue Links

            Activity

              People

                Unassigned Unassigned
                gjoseph Magnolia International
                Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved:

                  Checklists

                    Bug DoR
                    Task DoD