Public Member Functions | |
| __set ($attributeName, $value) | |
| save ($runValidation=true, array $attributeNames=null) | |
| unrestrictedSave ($runValidation=true, array $attributeNames=null) | |
| forgetOriginalAttributeValues () | |
Static Public Member Functions | |
| static | isTypeDeletable () |
Data Fields | |
| $originalAttributeValues = array() | |
Static Protected Attributes | |
| static | $lastClassInBeanHeirarchy = 'OwnedModel' |
A model 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 34 of file OwnedModel.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();
| $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 RedBeanModel.
Reimplemented in Permission.
Definition at line 49 of file OwnedModel.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 55 of file OwnedModel.php.
| static isTypeDeletable | ( | ) | [static] |
To be overriden on intermediate derived classes to return false so that deletes are not done on intermediate classes because the object relational mapping will not clean up properly. For example if User is a Person, and Person is a RedBeanModel delete should be called only on User, not on Person. So User must override isDeletable to return false.
Reimplemented from RedBeanModel.
Reimplemented in ConversationParticipant, EmailMessageContent, EmailMessageRecipient, EmailMessageSender, EmailMessageSendError, EmailSignature, Address, CurrencyValue, Email, Permission, Policy, and Right.
Definition at line 71 of file OwnedModel.php.