ModelRelationsAndAttributesToReportAdapter Class Reference

Inheritance diagram for ModelRelationsAndAttributesToReportAdapter:
ModelRelationsAndAttributesToRowsAndColumnsReportAdapter ModelRelationsAndAttributesToSummableReportAdapter CalendarModelRelationsAndAttributesToRowsAndColumnsReportAdapter MergeTagsModelRelationsAndAttributesToRowsAndColumnsReportAdapter ModelRelationsAndAttributesToMatrixReportAdapter ModelRelationsAndAttributesToSummationReportAdapter

Public Member Functions

 getModel ()
 getModelClassName ()
 getModuleClassName ()
 getRules ()
 __construct (RedBeanModel $model, ReportRules $rules, $reportType, $moduleClassName=null)
 getAttributeLabel ($attribute)
 getRelationLabel ($relation)
 isReportedOnAsARelation ($relationOrAttribute)
 getRelationModuleClassName ($relation)
 getRelationModelClassName ($relation)
 getAttributesForFilters ()
 getAttributesForDisplayAttributes ()
 getAttributesForOrderBys ()
 getAttributesForGroupBys ()
 getAvailableOperatorsType ($attribute)
 getFilterValueElementType ($attribute)
 getDisplayElementType ($attribute)
 getRealModelAttributeType ($attribute)
 getAllRelationsData ()
 getSelectableRelationsDataResolvedForUserAccess (User $user, Array $relations)
 getSelectableRelationsData (RedBeanModel $precedingModel=null, $precedingRelation=null)
 getAttributesIncludingDerivedAttributesData ()
 isRelationASingularRelation ($relation)
 isOwnedRelation ($relation)
 getInferredRelationsData (RedBeanModel $precedingModel=null, $precedingRelation=null)
 getFilterRulesByAttribute ($attribute, $ruleAttributeName)
 relationIsReportedAsAttribute ($relation)
 isDerivedRelationsViaCastedUpModelRelation ($relation)
 isInferredRelation ($relation)
 isDynamicallyDerivedAttribute ($attribute)
 getRawValueRelatedAttribute ($attribute)
 isAttributeReadOptimization ($attribute)
 isDerivedAttribute ($attribute)
 isDisplayAttributeMadeViaSelect ($attribute)

Static Public Member Functions

static forgetAll ()
static make ($moduleClassName, $modelClassName, $reportType)
static resolveRealAttributeName ($attribute)

Data Fields

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

Protected Member Functions

 getAttributesNotIncludingDerivedAttributesData ()
 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)
 getDerivedAttributesData ()
 getDynamicallyDerivedAttributesData ()
 getInferredRelationModelClassNamesForRelation ($relation)
 resolveRelationToSelectableRelationData (&$attributes, $attribute)
 getDerivedAttributesDataByReportRules ()

Protected Attributes

 $model
 $rules
 $reportType
 $moduleClassName

Detailed Description

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

Definition at line 40 of file ModelRelationsAndAttributesToReportAdapter.php.


Constructor & Destructor Documentation

__construct ( RedBeanModel model,
ReportRules rules,
reportType,
moduleClassName = null 
)
Parameters:
RedBeanModel $model
ReportRules $rules
string $reportType
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 183 of file ModelRelationsAndAttributesToReportAdapter.php.


Member Function Documentation

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

Definition at line 110 of file ModelRelationsAndAttributesToReportAdapter.php.

getModel (  ) 
getModelClassName (  ) 
Returns:
string

Definition at line 154 of file ModelRelationsAndAttributesToReportAdapter.php.

getModuleClassName (  ) 
Returns:
string

Definition at line 162 of file ModelRelationsAndAttributesToReportAdapter.php.

getRules (  ) 
Returns:
ReportRules

Definition at line 170 of file ModelRelationsAndAttributesToReportAdapter.php.

getAttributeLabel ( attribute  ) 

Enter description here ...

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

Reimplemented in ModelRelationsAndAttributesToSummableReportAdapter.

Definition at line 203 of file ModelRelationsAndAttributesToReportAdapter.php.

getRelationLabel ( relation  ) 

Enter description here ...

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

Definition at line 232 of file ModelRelationsAndAttributesToReportAdapter.php.

isReportedOnAsARelation ( relationOrAttribute  ) 

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

Parameters:
string $relationOrAttribute
Returns:
bool

Definition at line 249 of file ModelRelationsAndAttributesToReportAdapter.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 268 of file ModelRelationsAndAttributesToReportAdapter.php.

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

if (count($relationAndInferredOrViaData) == 4) { list($modelClassName, $notUsed, $notUsed2, $notUsed3) = $relationAndInferredOrViaData; return $modelClassName; }

elseif (count($relationAndInferredOrViaData) == 2) { list($relation, $notUsed) = $relationAndInferredOrViaData; return $this->model->getRelationModelClassName($relation); }

Definition at line 301 of file ModelRelationsAndAttributesToReportAdapter.php.

getAttributesForFilters (  ) 
getAttributesForDisplayAttributes (  ) 

Override and implement in children classes

Reimplemented in ModelRelationsAndAttributesToRowsAndColumnsReportAdapter.

Definition at line 355 of file ModelRelationsAndAttributesToReportAdapter.php.

getAttributesForOrderBys (  ) 

Override and implement in children classes

Reimplemented in ModelRelationsAndAttributesToRowsAndColumnsReportAdapter.

Definition at line 363 of file ModelRelationsAndAttributesToReportAdapter.php.

getAttributesForGroupBys (  ) 

Override and implement in children classes

Reimplemented in ModelRelationsAndAttributesToSummableReportAdapter.

Definition at line 371 of file ModelRelationsAndAttributesToReportAdapter.php.

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

Definition at line 381 of file ModelRelationsAndAttributesToReportAdapter.php.

getFilterValueElementType ( 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 414 of file ModelRelationsAndAttributesToReportAdapter.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

Reimplemented in ModelRelationsAndAttributesToSummableReportAdapter.

Definition at line 445 of file ModelRelationsAndAttributesToReportAdapter.php.

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

Definition at line 470 of file ModelRelationsAndAttributesToReportAdapter.php.

getAllRelationsData (  ) 
Returns:
array

Definition at line 479 of file ModelRelationsAndAttributesToReportAdapter.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 report.

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

Definition at line 500 of file ModelRelationsAndAttributesToReportAdapter.php.

getSelectableRelationsData ( RedBeanModel precedingModel = null,
precedingRelation = null 
)

Returns the array of selectable relations for creating a report. Does not include relations that are marked as nonReportable in the rules and also excludes relations that are marked as relations reportedAsAttributes by the rules. Includes relations marked as derivedRelationsViaCastedUpModel.

Public for testing only

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

Reimplemented in CalendarModelRelationsAndAttributesToRowsAndColumnsReportAdapter, and MergeTagsModelRelationsAndAttributesToRowsAndColumnsReportAdapter.

Definition at line 531 of file ModelRelationsAndAttributesToReportAdapter.php.

getAttributesIncludingDerivedAttributesData (  ) 
Returns:
array

Definition at line 559 of file ModelRelationsAndAttributesToReportAdapter.php.

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

Definition at line 573 of file ModelRelationsAndAttributesToReportAdapter.php.

isOwnedRelation ( relation  ) 

Assumes for now that we only need to know about real attributes that are 'owned'.

Parameters:
$relation 
Returns:
bool
Exceptions:
NotSupportedException 

Definition at line 617 of file ModelRelationsAndAttributesToReportAdapter.php.

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

Definition at line 652 of file ModelRelationsAndAttributesToReportAdapter.php.

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

Definition at line 690 of file ModelRelationsAndAttributesToReportAdapter.php.

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

Reimplemented in ModelRelationsAndAttributesToSummableReportAdapter.

Definition at line 720 of file ModelRelationsAndAttributesToReportAdapter.php.

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

Definition at line 742 of file ModelRelationsAndAttributesToReportAdapter.php.

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

Definition at line 757 of file ModelRelationsAndAttributesToReportAdapter.php.

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

Definition at line 772 of file ModelRelationsAndAttributesToReportAdapter.php.

getRawValueRelatedAttribute ( attribute  ) 
Parameters:
string $attribute
Returns:
null|string

Definition at line 787 of file ModelRelationsAndAttributesToReportAdapter.php.

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

Definition at line 800 of file ModelRelationsAndAttributesToReportAdapter.php.

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

Definition at line 813 of file ModelRelationsAndAttributesToReportAdapter.php.

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

Reimplemented in ModelRelationsAndAttributesToSummableReportAdapter.

Definition at line 828 of file ModelRelationsAndAttributesToReportAdapter.php.

isDisplayAttributeMadeViaSelect ( attribute  ) 

Override when some attributes can be made via select and not via the model. An example of a viaSelect is SUM(amount) since that is not derived via a model but directly from the results of a query.

Parameters:
$attribute 
Returns:
bool

Reimplemented in ModelRelationsAndAttributesToSummableReportAdapter.

Definition at line 855 of file ModelRelationsAndAttributesToReportAdapter.php.

getAttributesNotIncludingDerivedAttributesData (  )  [protected]
Returns:
array

Definition at line 864 of file ModelRelationsAndAttributesToReportAdapter.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 892 of file ModelRelationsAndAttributesToReportAdapter.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 915 of file ModelRelationsAndAttributesToReportAdapter.php.

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

Definition at line 942 of file ModelRelationsAndAttributesToReportAdapter.php.

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

Definition at line 956 of file ModelRelationsAndAttributesToReportAdapter.php.

getDerivedAttributesData (  )  [protected]
Returns:
array|null

Definition at line 989 of file ModelRelationsAndAttributesToReportAdapter.php.

getDynamicallyDerivedAttributesData (  )  [protected]
Returns:
array

Definition at line 1010 of file ModelRelationsAndAttributesToReportAdapter.php.

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

Definition at line 1035 of file ModelRelationsAndAttributesToReportAdapter.php.

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

Definition at line 1045 of file ModelRelationsAndAttributesToReportAdapter.php.

getDerivedAttributesDataByReportRules (  )  [protected]

Gets derived attribute date by report rules

Returns:
array

Definition at line 1056 of file ModelRelationsAndAttributesToReportAdapter.php.


The documentation for this class was generated from the following file:
 All Data Structures Functions Variables
Generated on Fri Nov 24 07:10:27 2017