RedBeanMutableRelatedModels Class Reference

Inheritance diagram for RedBeanMutableRelatedModels:
RedBeanModels RedBeanManyToManyRelatedModels RedBeanOneToManyRelatedModels

Public Member Functions

 contains (RedBeanModel $model)
 add (RedBeanModel $model)
 remove (RedBeanModel $model)
 removeByIndex ($i)
 removeAll ()
 getErrors ($attributeNameOrNames=null)
 save ($runValidation=true)
 isModified ()

Static Protected Member Functions

static array_remove_object (&$array, $object)

Protected Attributes

 $modified = false
 $deferredRelateBeans = array()
 $deferredUnrelateBeans = array()

Detailed Description

Contains all of the models of a particular type associated with a model in a one to many relationship. Once added this controls the lifetime of the models.

Definition at line 45 of file RedBeanMutableRelatedModels.php.


Member Function Documentation

contains ( RedBeanModel model  ) 

Returns whether the given model is already in the collection.

Reimplemented from RedBeanModels.

Definition at line 63 of file RedBeanMutableRelatedModels.php.

add ( RedBeanModel model  ) 

Adds a related model.

Reimplemented in RedBeanOneToManyRelatedModels.

Definition at line 73 of file RedBeanMutableRelatedModels.php.

remove ( RedBeanModel model  ) 

Unrelates a model.

Definition at line 93 of file RedBeanMutableRelatedModels.php.

removeByIndex ( i  ) 

Unrelates a model by index.

Reimplemented in RedBeanOneToManyRelatedModels.

Definition at line 112 of file RedBeanMutableRelatedModels.php.

removeAll (  ) 

Unrelates all of the related models.

Definition at line 153 of file RedBeanMutableRelatedModels.php.

getErrors ( attributeNameOrNames = null  ) 

Returns the errors for the related models.

Parameters:
$attributeNameOrNames See RedNeamModel::getErrors().

Reimplemented in RedBeanManyToManyRelatedModels.

Definition at line 168 of file RedBeanMutableRelatedModels.php.

save ( runValidation = true  ) 

Saves all of the models in the collection that have been lazily retrieved.

Reimplemented from RedBeanModels.

Reimplemented in RedBeanManyToManyRelatedModels, and RedBeanOneToManyRelatedModels.

Definition at line 182 of file RedBeanMutableRelatedModels.php.

isModified (  ) 

Returns true if any of the models have been added to or removed from the collection or of any models in the collection have been modified.

Reimplemented from RedBeanModels.

Definition at line 197 of file RedBeanMutableRelatedModels.php.


Field Documentation

$deferredRelateBeans = array() [protected]

Contains beans that need relating on save. They are not related on add so that if save is never called nothing is left in the database.

Definition at line 54 of file RedBeanMutableRelatedModels.php.

$deferredUnrelateBeans = array() [protected]

Contains beans that need unrelating on save. They are not unrelated on remove so that if save is never called the relation is still in the database.

Definition at line 61 of file RedBeanMutableRelatedModels.php.


The documentation for this class was generated from the following file:
 All Data Structures Functions Variables
Generated on Sun Jul 23 07:10:30 2017