Ability to work with main event from OnBefore/OnAfter type events called from kDBItem class
Components
Labels
Description
Context Information
Additional information (do not use)
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.
Attachments
relates to
Activity
Alex July 25, 2012 at 10:33 AM
Since 5.2.0 version was released.
Alex October 12, 2011 at 8:51 AM
Patch "temp_handler_ignored_parent_event_fix.patch" fixed problem, when objects created within temp handler were not having reference to event, that called temp handler method in first place.
Alex October 3, 2011 at 9:49 AM
Fix committed to [b]5.2.x branch/b. Commit Message:
Fixes #0000397: Ability to work with main event from OnBefore/OnAfter type events called from kDBItem class
Alex October 3, 2011 at 9:48 AM
Will test all together.
Dmitry Andrejev September 24, 2011 at 1:43 AM
New patch for 5.2.0 needed (PHP 5 format)
Priority
Assignee
Reporter
Developer
Patch Instructions
Patches must be submitted through Phabricator.
To submit patch via Command Line use Patches Workflow (via Arcanist) tutorial.
To submit patch via Web Interface use Patches Workflow (via Web Interface) tutorial.
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.