Uploaded image for project: 'In-Portal CMS'
  1. In-Portal CMS
  2. INP-330

Ability to work with main event from OnBefore/OnAfter type events called from kDBItem class

    XMLWordPrintable

    Details

    • Type: Bug Report
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 5.0.1
    • Fix Version/s: 5.2.0-B1
    • Component/s: Data Management
    • Labels:
      None
    • Additional information:
      Hide

      How I see implementation:
      1. add 2 methods to kDBItem class: setReferrerEvent(&$event) and removeReferrerEvent()
      2. when event of any type is called from kDBItem class (via raiseEvent method), then we set it's MasterEvent attribute to referrer event in case if any was set before.
      3. from OnBeforeItemCreate event OnCreate event will be accessed via $event->MasterEvent.

      Show
      How I see implementation: 1. add 2 methods to kDBItem class: setReferrerEvent(&$event) and removeReferrerEvent() 2. when event of any type is called from kDBItem class (via raiseEvent method), then we set it's MasterEvent attribute to referrer event in case if any was set before. 3. from OnBeforeItemCreate event OnCreate event will be accessed via $event->MasterEvent.
    • Story Points:
      2
    • External issue ID:
      397
    • Copy Issue Key:
    • Patch Instructions:

      Patches must be submitted through Phabricator.

      Description

      There are two type of events:
      1. external events - events, that could be called from outside of the script, by specifying their name in url
      2. internal events - events, that are called by internal subroutines only and in most cases are indirectly related to external event being called.

      For example OnCreate event is pure external and it allows to create record in database based on form data form request. On the other hand OnBeforeItemCreate is pure internal event, that is called before attempt is made to create database record. This internal event is indirectly called from OnCreate event by calling kDBItem::Create method.

      All seems normal at first glance, but in fact it's not. There is no way to access OnCreate event $event object from OnBeforeItemCreate event. One of purposes of such type of access is to change redirect parameters or main event. For example in case of TestField value is equals to 5 we want to redirect user to non-default template after record is successful created.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                alex Alex
                Reporter:
                alex Alex
                Developer:
                Alex
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: