asprin
Active member
There are two ways that I'm allowing an update of a custom entity.
1. A logged in user with appropriate permission manually updating it via a form submit
2. Via a
Now I've a
	
	
	
		
In other words, I don't want to populate
Is this possible? Maybe checking the stack trace??
				
			1. A logged in user with appropriate permission manually updating it via a form submit
2. Via a
enqueueLater() jobNow I've a
_preSave() defined on the entity's class. But I'm wondering if inside this function I know how how the entity was updated.
		PHP:
	
	protected function _preSave()
{
    if($this->isUpdate())
    {
        // figure out if a user submitted a form
        // or the job has triggered the update
        // so tha I can do the following
        if(<the update happened because of the form submitted by the user>)
        {
            $this->updated_by = \XF::visitor()->user_id;
            $this->updated_on = \XF::$time;
        }
    }
}
	In other words, I don't want to populate
updated_by and updated_on if the update happened via the job.Is this possible? Maybe checking the stack trace??