ModelRelationsAndAttributesToWorkflowAdapter Class Reference

Inheritance diagram for ModelRelationsAndAttributesToWorkflowAdapter:
ModelRelationsAndAttributesToByTimeWorkflowAdapter ModelRelationsAndAttributesToOnSaveWorkflowAdapter

Public Member Functions

 getModel ()
 getModelClassName ()
 getRules ()
 __construct (RedBeanModel $model, WorkflowRules $rules, $workflowType, $moduleClassName=null)
 getAttributeLabel ($attribute)
 getRelationLabel ($relation)
 isUsedAsARelation ($relationOrAttribute)
 getRelationModuleClassName ($relation)
 getRelationModelClassName ($relation)
 getAttributesForTriggers ()
 getAttributesForTimeTrigger ()
 getAllAttributesForActions ()
 getRequiredAttributesForActions ()
 getNonRequiredAttributesForActions ()
 getAvailableOperatorsType ($attribute)
 getTriggerValueElementType ($attribute)
 getDisplayElementType ($attribute)
 getRealModelAttributeType ($attribute)
 getAllRelationsData ()
 getSelectableRelationsDataResolvedForUserAccess (User $user, Array $relations)
 getSelectableRelationsData (RedBeanModel $precedingModel=null, $precedingRelation=null)
 getAttributesIncludingDerivedAttributesData ()
 isRelationASingularRelation ($relation)
 getInferredRelationsData (RedBeanModel $precedingModel=null, $precedingRelation=null, $onlyIncludeThisModelClassName=null)
 getTriggerRulesByAttribute ($attribute, $ruleAttributeName)
 relationIsUsedAsAttribute ($relation)
 isDerivedRelationsViaCastedUpModelRelation ($relation)
 isInferredRelation ($relation)
 isDynamicallyDerivedAttribute ($attribute)
 isAttributeReadOptimization ($attribute)
 isDerivedAttribute ($attribute)
 getSelectableRelationsDataForTriggers (RedBeanModel $precedingModel=null, $precedingRelation=null)
 getSelectableRelationsDataForEmailMessageRecipientModelRelation ()
 getSelectableContactRelationsDataForEmailMessageRecipientModelRelation ()
 getSelectableRelationsDataForActionTypeRelation ()

Static Public Member Functions

static make ($moduleClassName, $modelClassName, $workflowType)
static getInferredRelationModelClassName ($relation)
static resolveRealAttributeName ($attribute)
static isAttributeInferred ($attribute)

Data Fields

const DYNAMIC_ATTRIBUTE_USER = 'User'
const DYNAMIC_RELATION_INFERRED = 'Inferred'

Protected Member Functions

 getAttributesNotIncludingDerivedAttributesData ()
 resolveAttributesForActionsOrTimeTriggerData ($includeRequired=false, $includeNonRequired=false, $includeReadOnly=false)
 derivedRelationLinksToPrecedingRelation ($relationModelClassName, $opposingRelation, RedBeanModel $precedingModel=null, $precedingRelation=null)
 inferredRelationLinksToPrecedingRelation ($inferredModelClassName, $relation, RedBeanModel $precedingModel=null, $precedingRelation=null)
 relationLinksToPrecedingRelation ($relation, RedBeanModel $precedingModel=null, $precedingRelation=null)
 getDerivedRelationsViaCastedUpModelData (RedBeanModel $precedingModel=null, $precedingRelation=null, $onlyIncludeThisModelClassName=null)
 getDerivedAttributesData ()
 getDynamicallyDerivedAttributesData ()
 resolveDynamicallyDerivedAttributesForActionsOrTimeTriggerData ($includeRequired=false, $includeNonRequired=false, $includeReadOnly=false)
 getInferredRelationModelClassNamesForRelation ($relation)
 resolveRelationToSelectableRelationData (&$attributes, $attribute)

Protected Attributes

 $model
 $rules
 $workflowType
 $moduleClassName

Detailed Description

Base helper class for managing adapting model relations and attributes into a workflow rule

Definition at line 40 of file ModelRelationsAndAttributesToWorkflowAdapter.php.


Constructor & Destructor Documentation

__construct ( RedBeanModel model,
WorkflowRules rules,
workflowType,
moduleClassName = null 
)
Parameters:
RedBeanModel $model
WorkflowRules $rules
string $workflowType
string $moduleClassName - optional for when there is a stateAdapter involved. In the case of LeadsModule it still uses the Contact model but is important to know that the originating module is Leads. If moduleClassName is not specified, then it will default to the model's moduleClassName

Definition at line 144 of file ModelRelationsAndAttributesToWorkflowAdapter.php.


Member Function Documentation

static make ( moduleClassName,
modelClassName,
workflowType 
) [static]
Parameters:
string $moduleClassName
string $modelClassName
string $workflowType
Returns:
ModelRelationsAndAttributesToWorkflowAdapter
Exceptions:
NotSupportedException if the workflowType is invalid or null

Definition at line 84 of file ModelRelationsAndAttributesToWorkflowAdapter.php.

getModel (  ) 
getModelClassName (  ) 
Returns:
string

Definition at line 123 of file ModelRelationsAndAttributesToWorkflowAdapter.php.

getRules (  ) 
getAttributeLabel ( attribute  ) 

Enter description here ...

Parameters:
string $attribute
Exceptions:
NotSupportedException if the label is missing for the attribute

Definition at line 163 of file ModelRelationsAndAttributesToWorkflowAdapter.php.

getRelationLabel ( relation  ) 

Enter description here ...

Parameters:
string $relation
Exceptions:
NotSupportedException if the label is missing for the relation

Definition at line 187 of file ModelRelationsAndAttributesToWorkflowAdapter.php.

isUsedAsARelation ( relationOrAttribute  ) 

Returns true/false if a string passed in is considered a relation from a workflow perspective. In this case a dropDown is not considered a relation because it is used in workflow as a regular attribute.

Parameters:
string $relationOrAttribute
Returns:
bool

Definition at line 204 of file ModelRelationsAndAttributesToWorkflowAdapter.php.

getRelationModuleClassName ( relation  ) 
Parameters:
string $relation
Returns:
module class name. Resolves for inferred and derived relations
Exceptions:
NotSupportedException if the relation string is malformed

Definition at line 223 of file ModelRelationsAndAttributesToWorkflowAdapter.php.

getRelationModelClassName ( relation  ) 
Parameters:
string $relation
Returns:
model class name. Resolves for inferred and derived relations
Exceptions:
NotSupportedException if the relation is malformed

Definition at line 255 of file ModelRelationsAndAttributesToWorkflowAdapter.php.

static getInferredRelationModelClassName ( relation  )  [static]
Parameters:
$relation 
Returns:
mixed

Definition at line 283 of file ModelRelationsAndAttributesToWorkflowAdapter.php.

getAttributesForTriggers (  ) 

Override and implement in children classes

Definition at line 298 of file ModelRelationsAndAttributesToWorkflowAdapter.php.

getAttributesForTimeTrigger (  ) 

Override and implement in children classes

Reimplemented in ModelRelationsAndAttributesToByTimeWorkflowAdapter.

Definition at line 309 of file ModelRelationsAndAttributesToWorkflowAdapter.php.

getAllAttributesForActions (  ) 

Used by update actions since there is no difference between required and non-required.

Returns:
sorted array

Definition at line 318 of file ModelRelationsAndAttributesToWorkflowAdapter.php.

getRequiredAttributesForActions (  ) 
Returns:
sorted array

Definition at line 330 of file ModelRelationsAndAttributesToWorkflowAdapter.php.

getNonRequiredAttributesForActions (  ) 
Returns:
sorted array

Definition at line 342 of file ModelRelationsAndAttributesToWorkflowAdapter.php.

getAvailableOperatorsType ( attribute  ) 
Parameters:
string $attribute
Returns:
null|string
Exceptions:
NotSupportedException if the attribute is a derived attribute

Definition at line 356 of file ModelRelationsAndAttributesToWorkflowAdapter.php.

getTriggerValueElementType ( attribute  ) 
Parameters:
string $attribute
Returns:
null|string
Exceptions:
NotSupportedException if the attribute is dynamically derived but not a __User attribute since this is the only type of dynamically derived attributes that are currently supported

Definition at line 383 of file ModelRelationsAndAttributesToWorkflowAdapter.php.

getDisplayElementType ( attribute  ) 
Parameters:
string $attribute
Returns:
string
Exceptions:
NotSupportedException if the attribute is dynamically derived but not a __User attribute since this is the only type of dynamically derived attributes that are currently supported

Definition at line 414 of file ModelRelationsAndAttributesToWorkflowAdapter.php.

getRealModelAttributeType ( attribute  ) 
Parameters:
string $attribute
Returns:
string

Definition at line 439 of file ModelRelationsAndAttributesToWorkflowAdapter.php.

getAllRelationsData (  ) 
Returns:
array

Definition at line 448 of file ModelRelationsAndAttributesToWorkflowAdapter.php.

getSelectableRelationsDataResolvedForUserAccess ( User user,
Array $  relations 
)

Resolves relations to only return relations that the user has access too. always returns user relations since this is ok for a user to see when creating or editing a workflow rule

Parameters:
User $user
array $relations
Returns:
array
Exceptions:
NotSupportedException 

Definition at line 469 of file ModelRelationsAndAttributesToWorkflowAdapter.php.

getSelectableRelationsData ( RedBeanModel precedingModel = null,
precedingRelation = null 
)

Returns the array of selectable relations for creating a workflow rule. Does not include relations that are marked as cannotTrigger in the rules and also excludes relations that are marked as relations usedAsAttributes by the rules. Includes relations marked as derivedRelationsViaCastedUpModel.

Public for testing only

Parameters:
RedBeanModel $precedingModel
null $precedingRelation
Returns:
array
Exceptions:
NotSupportedException 

Reimplemented in ModelRelationsAndAttributesToByTimeWorkflowAdapter, and ModelRelationsAndAttributesToOnSaveWorkflowAdapter.

Definition at line 500 of file ModelRelationsAndAttributesToWorkflowAdapter.php.

getAttributesIncludingDerivedAttributesData (  ) 
Returns:
array

Definition at line 528 of file ModelRelationsAndAttributesToWorkflowAdapter.php.

isRelationASingularRelation ( relation  ) 
Parameters:
string $relation
Returns:
bool
Exceptions:
NotSupportedException if the relation string is malformed

Definition at line 542 of file ModelRelationsAndAttributesToWorkflowAdapter.php.

getInferredRelationsData ( RedBeanModel precedingModel = null,
precedingRelation = null,
onlyIncludeThisModelClassName = null 
)
Parameters:
RedBeanModel $precedingModel
null|string $precedingRelation
null|string $onlyIncludeThisModelClassName
Returns:
array
Exceptions:
NotSupportedException if there the preceding model and relation are not either both defined or both null

Definition at line 587 of file ModelRelationsAndAttributesToWorkflowAdapter.php.

getTriggerRulesByAttribute ( attribute,
ruleAttributeName 
)
Parameters:
string $attribute
string $ruleAttributeName
Returns:
array

Definition at line 624 of file ModelRelationsAndAttributesToWorkflowAdapter.php.

relationIsUsedAsAttribute ( relation  ) 
Parameters:
string $relation
Returns:
bool

Definition at line 656 of file ModelRelationsAndAttributesToWorkflowAdapter.php.

isDerivedRelationsViaCastedUpModelRelation ( relation  ) 
Parameters:
string $relation
Returns:
bool

Definition at line 678 of file ModelRelationsAndAttributesToWorkflowAdapter.php.

isInferredRelation ( relation  ) 
Parameters:
string $relation
Returns:
bool

Definition at line 693 of file ModelRelationsAndAttributesToWorkflowAdapter.php.

isDynamicallyDerivedAttribute ( attribute  ) 
Parameters:
string $attribute
Returns:
bool

Definition at line 708 of file ModelRelationsAndAttributesToWorkflowAdapter.php.

isAttributeReadOptimization ( attribute  ) 
Parameters:
string $attribute
Returns:
bool

Definition at line 723 of file ModelRelationsAndAttributesToWorkflowAdapter.php.

isDerivedAttribute ( attribute  ) 
Parameters:
string $attribute
Returns:
bool

Definition at line 737 of file ModelRelationsAndAttributesToWorkflowAdapter.php.

static resolveRealAttributeName ( attribute  )  [static]
Parameters:
string attribute
Returns:
real model attribute name. Parses for Inferred

Definition at line 752 of file ModelRelationsAndAttributesToWorkflowAdapter.php.

static isAttributeInferred ( attribute  )  [static]

Passing in an attribute string such as Account__activityItems__Inferred, detect if attribute is a inferred attribute or not.

Parameters:
$attribute 
Returns:
bool

Definition at line 779 of file ModelRelationsAndAttributesToWorkflowAdapter.php.

getSelectableRelationsDataForTriggers ( RedBeanModel precedingModel = null,
precedingRelation = null 
)
Parameters:
RedBeanModel $precedingModel
null $precedingRelation
Returns:
array $sortedAttributes
Exceptions:
NotSupportedException 

Definition at line 797 of file ModelRelationsAndAttributesToWorkflowAdapter.php.

getSelectableRelationsDataForEmailMessageRecipientModelRelation (  ) 

Exclude User relations and Owned relations. Utilized by

See also:
DynamicTriggeredModelRelationUserWorkflowEmailMessageRecipientForm
Returns:
sorted array

Definition at line 837 of file ModelRelationsAndAttributesToWorkflowAdapter.php.

getSelectableContactRelationsDataForEmailMessageRecipientModelRelation (  ) 

Only includes relations that are to the 'Contact' model Utilized by

See also:
DynamicTriggeredModelRelationUserWorkflowEmailMessageRecipientForm
Returns:
sorted array

Definition at line 847 of file ModelRelationsAndAttributesToWorkflowAdapter.php.

getSelectableRelationsDataForActionTypeRelation (  ) 

Exclude User relations and Owned relations.

Returns:
sorted array

Definition at line 871 of file ModelRelationsAndAttributesToWorkflowAdapter.php.

getAttributesNotIncludingDerivedAttributesData (  )  [protected]
Returns:
array

Definition at line 894 of file ModelRelationsAndAttributesToWorkflowAdapter.php.

resolveAttributesForActionsOrTimeTriggerData ( includeRequired = false,
includeNonRequired = false,
includeReadOnly = false 
) [protected]
Parameters:
boolean $includeRequired
boolean $includeNonRequired
$includeReadOnly 
Returns:
array

Definition at line 916 of file ModelRelationsAndAttributesToWorkflowAdapter.php.

derivedRelationLinksToPrecedingRelation ( relationModelClassName,
opposingRelation,
RedBeanModel precedingModel = null,
precedingRelation = null 
) [protected]
Parameters:
string $relationModelClassName
string $opposingRelation
null|RedBeanModel $precedingModel
null|string $precedingRelation
Returns:
bool

Definition at line 951 of file ModelRelationsAndAttributesToWorkflowAdapter.php.

inferredRelationLinksToPrecedingRelation ( inferredModelClassName,
relation,
RedBeanModel precedingModel = null,
precedingRelation = null 
) [protected]
Parameters:
string $inferredModelClassName
string $relation
null|RedBeanModel $precedingModel
null|string $precedingRelation
Returns:
bool

Definition at line 975 of file ModelRelationsAndAttributesToWorkflowAdapter.php.

relationLinksToPrecedingRelation ( relation,
RedBeanModel precedingModel = null,
precedingRelation = null 
) [protected]
Parameters:
string $relation
null|RedBeanModel $precedingModel
null|string $precedingRelation
Returns:
bool

Definition at line 1003 of file ModelRelationsAndAttributesToWorkflowAdapter.php.

getDerivedRelationsViaCastedUpModelData ( RedBeanModel precedingModel = null,
precedingRelation = null,
onlyIncludeThisModelClassName = null 
) [protected]
Parameters:
RedBeanModel $precedingModel
null|string $precedingRelation
null|string $onlyIncludeThisModelClassName
Returns:
array
Exceptions:
NotSupportedException if there the preceding model and relation are not either both defined or both null

Definition at line 1018 of file ModelRelationsAndAttributesToWorkflowAdapter.php.

getDerivedAttributesData (  )  [protected]
Returns:
array|null

Definition at line 1056 of file ModelRelationsAndAttributesToWorkflowAdapter.php.

getDynamicallyDerivedAttributesData (  )  [protected]
Returns:
array

Definition at line 1075 of file ModelRelationsAndAttributesToWorkflowAdapter.php.

resolveDynamicallyDerivedAttributesForActionsOrTimeTriggerData ( includeRequired = false,
includeNonRequired = false,
includeReadOnly = false 
) [protected]
Parameters:
boolean $includeRequired
boolean $includeNonRequired
$includeReadOnly 
Returns:
array

Definition at line 1097 of file ModelRelationsAndAttributesToWorkflowAdapter.php.

getInferredRelationModelClassNamesForRelation ( relation  )  [protected]
Parameters:
$relation 
Returns:
null|string

Definition at line 1155 of file ModelRelationsAndAttributesToWorkflowAdapter.php.

resolveRelationToSelectableRelationData ( &$  attributes,
attribute 
) [protected]
Parameters:
array $attributes
string $attribute

Definition at line 1165 of file ModelRelationsAndAttributesToWorkflowAdapter.php.


The documentation for this class was generated from the following file:
 All Data Structures Functions Variables
Generated on Sun Mar 26 07:10:27 2017