OwnedMultipleValuesCustomField Class Reference

Inheritance diagram for OwnedMultipleValuesCustomField:
MultipleValuesCustomField BaseCustomField RedBeanModel BeanModel ObservableComponent

Public Member Functions

 __set ($attributeName, $value)
 __get ($attributeName)
 resolveOriginalCustomFieldValuesDataForNewData ()
 save ($runValidation=true, array $attributeNames=null)
 forgetOriginalAttributeValues ()

Static Public Member Functions

static getCanHaveBean ()

Data Fields

 $originalAttributeValues = array()

Protected Member Functions

 afterSave ()

Detailed Description

A MultipleValuesCustomField owned by a SecurableItem in the sense that it is included in a relation with RedBeanModel::OWNED - its lifetime is controlled by the owning model. SecurableItems are secured and auditable and so the related models that they own are secured and auditable.

Definition at line 44 of file OwnedMultipleValuesCustomField.php.


Member Function Documentation

static getCanHaveBean (  )  [static]
See also:
RedBeanModel::getHasBean()

Reimplemented from BeanModel.

Definition at line 74 of file OwnedMultipleValuesCustomField.php.

__set ( attributeName,
value 
)

Sets the members and relations of the model as if they were actual attributes of the model. For example, if Account extends RedBeanModel and its attributeNames() returns that one it has a member 'name' and a relation 'owner' they are simply accessed as:

   $account = new Account();
   $account->name = 'International Corp';
   $account->owner = User::getByUsername('bill');
   $account->save();
Parameters:
$attributeName A non-empty string that is the name of a member or relation of the model.
$value A value or model of the type specified as valid for the member or relation by the meta data supplied by the extending class's getMetadata() method.

Reimplemented from BaseCustomField.

Definition at line 83 of file OwnedMultipleValuesCustomField.php.

__get ( attributeName  ) 

Method extended to provide some additional logic. Because the relation 'values' data is going to be processed for audit in this class, the original data for 'values' needs to be stored when a __get is performed. Normally during __set this is performed, but we cannot do this because we can't override the __set in the 'values' class. The 'values' class is a RedBeanOneToManyRelationModels. This data then will be further processed in the afterSave method. (non-PHPdoc)

See also:
RedBeanModel::__get()
$this->afterSave

Reimplemented from RedBeanModel.

Definition at line 99 of file OwnedMultipleValuesCustomField.php.

resolveOriginalCustomFieldValuesDataForNewData (  ) 

Utilized by workflow engine. Resolves and returns data only if a change has been made to 'values'. Otherwise returns null. Make sure to use === when evaluating this for null. Be careful when calling this as this will not always contain the correct information if you didn't already call ->values previously.

Returns:
array

Definition at line 124 of file OwnedMultipleValuesCustomField.php.

save ( runValidation = true,
array $  attributeNames = null 
)

Saves the model to the database. Models are only saved if they have been modified and related models are saved before this model. If a related model is modified and needs saving the deems the model to be modified and need saving, which ensures that keys are updated. Cyclic relationships are prevented from causing problems by the save only proceeding to non-saved models.

Reimplemented from RedBeanModel.

Definition at line 140 of file OwnedMultipleValuesCustomField.php.

afterSave (  )  [protected]

Extended method to properly process 'values' audit information. The original information is stored during a __get call. (non-PHPdoc)

See also:
RedBeanModel::afterSave()
$this->__get

Reimplemented from RedBeanModel.

Definition at line 153 of file OwnedMultipleValuesCustomField.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