All Data Structures Functions Variables Pages
Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes
WorkflowActionProcessingHelper Class Reference

Public Member Functions

 __construct ($workflowId, $workflowName, ActionForWorkflowForm $action, RedBeanModel $triggeredModel, User $triggeredByUser, $canSaveTriggeredModel=true)
 
 processUpdateSelfAction ()
 
 processNonUpdateSelfAction ()
 

Protected Member Functions

 processUpdateRelatedAction ()
 
 processCreateAction ()
 
 resolveCreateModel (RedBeanModel $model, $relation, &$modelToForgetCache=null)
 
 processCreateRelatedAction ()
 
 processSubscribeToListAction ()
 
 resolveOneToManyPostCreateActionSaveModelCache (RedBeanModel $precedingModel, $precedingRelation, RedBeanModel $model)
 
 processUnsubscribeFromListAction ()
 
 processCreateCommentAction ()
 
 logAndNotifyOnMissingMarketingListModel ($type)
 

Static Protected Member Functions

static processActionAttributesForActionBeforeSave (ActionForWorkflowForm $action, RedBeanModel $model, User $triggeredByUser, RedBeanModel $triggeredModel, $create=false)
 
static processActionAttributesForActionAfterSave (ActionForWorkflowForm $action, RedBeanModel $model, User $triggeredByUser, RedBeanModel $triggeredModel)
 

Protected Attributes

 $workflowId
 
 $workflowName
 
 $action
 
 $triggeredModel
 
 $triggeredByUser
 
 $canSaveTriggeredModel
 

Detailed Description

Helper class for processing actions that trigger

Definition at line 40 of file WorkflowActionProcessingHelper.php.

Constructor & Destructor Documentation

__construct (   $workflowId,
  $workflowName,
ActionForWorkflowForm  $action,
RedBeanModel  $triggeredModel,
User  $triggeredByUser,
  $canSaveTriggeredModel = true 
)
Parameters
int$workflowId
string$workflowName
ActionForWorkflowForm$action
RedBeanModel$triggeredModel
User$triggeredByUser
bool$canSaveTriggeredModel- when processing a
See Also
ByTimeWorkflowInQueueJob the job will handle saving the model, so when creating new models as a result of an action, there is no need here to save the triggered model. This parameter then would be set to false in that scenario. Otherwise the triggered model will be saved when necessary since it is assumed it will not be saved after this execution.

Definition at line 83 of file WorkflowActionProcessingHelper.php.

Member Function Documentation

static processActionAttributesForActionBeforeSave ( ActionForWorkflowForm  $action,
RedBeanModel  $model,
User  $triggeredByUser,
RedBeanModel  $triggeredModel,
  $create = false 
)
staticprotected
Parameters
ActionForWorkflowForm$action
RedBeanModel$model
User$triggeredByUser
RedBeanModel$triggeredModel
boolean$create

Definition at line 141 of file WorkflowActionProcessingHelper.php.

static processActionAttributesForActionAfterSave ( ActionForWorkflowForm  $action,
RedBeanModel  $model,
User  $triggeredByUser,
RedBeanModel  $triggeredModel 
)
staticprotected
Parameters
ActionForWorkflowForm$action
RedBeanModel$model
User$triggeredByUser
RedBeanModel$triggeredModel

Definition at line 193 of file WorkflowActionProcessingHelper.php.

resolveCreateModel ( RedBeanModel  $model,
  $relation,
$modelToForgetCache = null 
)
protected
Parameters
RedBeanModel$model
$relation
null$modelToForgetCache
Returns
bool true if the $model passed in needs to be saved again. Otherwise false if not.
Exceptions
NotSupportedException
FailedToSaveModelException

Definition at line 300 of file WorkflowActionProcessingHelper.php.

processCreateRelatedAction ( )
protected

Notice the use of $modelToForgetCache. This was needed to avoid a caching issue with the following example. If an opportunity fires, and a related account's opportunity is created. This new opportunity had a cached model for account that was null. So this is fixed by forgetting the new model after it is added to the account.

Exceptions
FailedToSaveModelException
NotSupportedException

Definition at line 382 of file WorkflowActionProcessingHelper.php.

resolveOneToManyPostCreateActionSaveModelCache ( RedBeanModel  $precedingModel,
  $precedingRelation,
RedBeanModel  $model 
)
protected
See Also
https://www.pivotaltracker.com/story/show/58372836 This method is called to resolve the issue of the cache having incorrect information and requiring a clearCache Now after saving, it will resolve the related model correctly.
Parameters
RedBeanModel$precedingModel
string$precedingRelation
RedBeanModel$model

Definition at line 487 of file WorkflowActionProcessingHelper.php.

processCreateCommentAction ( )
protected

Create comments for triggered model.

Exceptions
NotSupportedException

Definition at line 552 of file WorkflowActionProcessingHelper.php.


The documentation for this class was generated from the following file:
Generated on Thu Feb 20 2020 07:10:56