BeanModel Class Reference

Inheritance diagram for BeanModel:
ObservableComponent RedBeanModel A ActiveLanguage AuditEvent BaseCustomField BaseStarredModel ContactState Currency CustomFieldData CustomFieldsModel CustomFieldValue DateDateTime DDD DerivedAttributeMetadata E F FFF FileContent G GameNotification GGG GlobalMetadata H HHH III KanbanItem M MashableInboxForTestModel MessageSource MessageTranslation MixedRelationsModel NoBean OwnedModel P PerUserMetadata Portlet PP PPP PPPP ProjectAuditEvent QueryFromModel SavedCalendarSubscription ShortUrl StuckJob TestAttributeNamedLikeSqlKeywordModel TestBlobModel TestBooleanAttributeModel TestDatabaseBulkInsertModel TestDataUtilModel TestDateTimeModel TestDateTimeUserModel TestDefaultedAttributeModel TestGetAttributeLabelModel TestIdentityModel TestInvalidSpecificLinkType TestManyManyRelationToItemModel TestModelToMessagesModel TestNameModel TestOperatorTypeModel TestPolyOneToManyOneSide TestPolyOneToManyOneSideTwo TestPolyOneToManyPolySide TestPolyOneToManyPolySideOwned TestPrecisionModel TestReadOnlyAttributeModel TestSelfRelatingModel TestSimplestManyRelationModel TestSimplestModel TestTypesModel TestViewMetadataValidatorModel ThingWithCalculatedDates Z ZZ

Static Public Member Functions

static getCanHaveBean ()
static getMetadata ()
static isAnAttribute ($attributeName)
static resolveAttributeModelClassName ($attributeName)
static getAttributeModelClassName ($attributeName)
static isRelation ($attributeName)
static isOwnedRelation ($attributeName)
static getRelationType ($relationName)
static getRelationModelClassName ($relationName)
static getRelationLinkType ($relationName)
static getRelationLinkName ($relationName)
static isRelationTypeAHasManyVariant ($relationName)
static isRelationTypeAHasOneVariant ($relationName)
static isADerivedRelationViaCastedUpModel ($relationName)
static getDerivedRelationType ($relationName)
static getDerivedRelationModelClassName ($relationName)
static getDerivedRelationViaCastedUpModelOpposingRelationName ($relationName)
static getInferredRelationModelClassNamesForRelation ($relation)
static getColumnNameByAttribute ($attributeName)
static getAttributeNames ()
static generateAnAttributeLabel ($attributeName)
static getAbbreviatedAttributeLabel ($attributeName)
static getTranslatedAttributeLabels ($language)
static getMixedInModelClassNames ()
static isRelationTypeAManyManyVariant ($relationName)

Data Fields

const HAS_ONE_BELONGS_TO = 0
const HAS_MANY_BELONGS_TO = 1
const HAS_ONE = 2
const HAS_MANY = 3
const MANY_MANY = 4
const OWNED = true
const NOT_OWNED = false
const CACHE_IDENTIFIER = 'BeanModelMapping'
const LINK_TYPE_ASSUMPTIVE = 0
const LINK_TYPE_SPECIFIC = 1
const LINK_TYPE_POLYMORPHIC = 2

Static Protected Member Functions

static translatedAbbreviatedAttributeLabels ($language)
static translatedAttributeLabels ($language)
static getAttributeNamesToClassNamesForModel ()
static getAttributeNamesNotBelongsToOrManyManyForModel ()
static getRelationNameToRelationTypeModelClassNameAndOwnsForModel ()
static getDerivedRelationNameToTypeModelClassNameAndOppposingRelationForModel ()
static forgetBeanModel ($modelClassName)
static forgetAllBeanModels ()
static resolveCacheAndMapMetadataForAllClassesInHeirarchy ()
static resolveLinkTypeAndRelationLinkName ($relationTypeModelClassNameAndOwns, &$linkType, &$relationLinkName)

Static Protected Attributes

static $lastClassInBeanHeirarchy = 'BeanModel'

Detailed Description

Base class for working with models. Handles mapping and caching of metadata and attribute information.

Definition at line 40 of file BeanModel.php.


Member Function Documentation

static getCanHaveBean (  )  [static]
Returns:
boolean

Reimplemented in CustomFieldsModel, NoBean, MashableActivity, OwnedCustomField, OwnedModel, and OwnedMultipleValuesCustomField.

Definition at line 158 of file BeanModel.php.

static getMetadata (  )  [static]

Implement in children classes

Exceptions:
NotImplementedException 

Reimplemented in RedBeanModel, and User.

Definition at line 167 of file BeanModel.php.

static isAnAttribute ( attributeName  )  [static]

Static alternative to using isAttribute which is a concrete method.

Parameters:
$attributeName 
Returns:
bool

Definition at line 177 of file BeanModel.php.

static resolveAttributeModelClassName ( attributeName  )  [static]

This method is needed to interpret when the attributeName is 'id'. Since id is not an attribute on the model, we manaully check for this and return the appropriate class name.

Parameters:
string $attributeName
Returns:
the model class name for the attribute. This could be a casted up model class name.

Definition at line 190 of file BeanModel.php.

static getAttributeModelClassName ( attributeName  )  [static]

Returns the model class name for an attribute name defined by the extending class's getMetadata() method. For use by RedBeanModelDataProvider. Is unlikely to be of any use to an application.

Parameters:
string $attributeName

Definition at line 207 of file BeanModel.php.

static isRelation ( attributeName  )  [static]

Returns true if the named attribute is one of the relation names defined by the extending class's getMetadata() method.

Definition at line 219 of file BeanModel.php.

static isOwnedRelation ( attributeName  )  [static]

Returns true if the named attribute is one of the relation names defined by the extending class's getMetadata() method, and specifies RedBeanModel::OWNED.

Definition at line 230 of file BeanModel.php.

static getRelationType ( relationName  )  [static]

Returns the relation type relation name defined by the extending class's getMetadata() method.

Definition at line 242 of file BeanModel.php.

static getRelationModelClassName ( relationName  )  [static]

Returns the model class name for a relation name defined by the extending class's getMetadata() method. For use by RedBeanModelDataProvider. Is unlikely to be of any use to an application.

Definition at line 255 of file BeanModel.php.

static getRelationLinkType ( relationName  )  [static]

Returns the link type for a relation name defined by the extending class's getMetadata() method.

Definition at line 266 of file BeanModel.php.

static getRelationLinkName ( relationName  )  [static]

Returns the link name for a relation name defined by the extending class's getMetadata() method.

Parameters:
string $relationName

Definition at line 278 of file BeanModel.php.

static isRelationTypeAHasManyVariant ( relationName  )  [static]
Parameters:
string $relationName
Returns:
bool

Definition at line 289 of file BeanModel.php.

static isRelationTypeAHasOneVariant ( relationName  )  [static]
Parameters:
string $relationName
Returns:
bool

Definition at line 305 of file BeanModel.php.

static isADerivedRelationViaCastedUpModel ( relationName  )  [static]
Parameters:
string $relationName
Returns:
boolean true if the relation is a derived relation

Definition at line 320 of file BeanModel.php.

static getDerivedRelationType ( relationName  )  [static]

Returns the relation type of a derived relation defined by the extending class's getMetadata() method.

Parameters:
string $relationName

Definition at line 335 of file BeanModel.php.

static getDerivedRelationModelClassName ( relationName  )  [static]

Returns the relation model class name of a derived relation defined by the extending class's getMetadata() method.

Parameters:
string $relationName

Definition at line 347 of file BeanModel.php.

static getDerivedRelationViaCastedUpModelOpposingRelationName ( relationName  )  [static]

Returns the opposing relation name of a derived relation defined by the extending class's getMetadata() method.

Definition at line 358 of file BeanModel.php.

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

Definition at line 369 of file BeanModel.php.

static getColumnNameByAttribute ( attributeName  )  [static]

Given an attribute return the column name.

Parameters:
string $attributeName
Returns:
string

Definition at line 387 of file BeanModel.php.

static getAttributeNames (  )  [static]

Static implementation of attributeNames()

Definition at line 405 of file BeanModel.php.

static generateAnAttributeLabel ( attributeName  )  [static]

Static implementation of generateAttributeLabel()

Definition at line 413 of file BeanModel.php.

static getAbbreviatedAttributeLabel ( attributeName  )  [static]

Given an attributeName, retrieve the translated attribute label. Attempts to find a customized label in the metadata first, before falling back on the standard attribute label for the specified attribute.

Parameters:
string $attributeName
Returns:
string - translated attribute label

Definition at line 424 of file BeanModel.php.

static getTranslatedAttributeLabels ( language  )  [static]

Public for message checker only

Parameters:
$language 
Returns:
array;

Definition at line 444 of file BeanModel.php.

static translatedAbbreviatedAttributeLabels ( language  )  [static, protected]

Array of untranslated abbreviated attribute labels.

Definition at line 452 of file BeanModel.php.

static getMixedInModelClassNames (  )  [static]
Returns:
array

Reimplemented in User.

Definition at line 465 of file BeanModel.php.

static getAttributeNamesToClassNamesForModel (  )  [static, protected]
Returns:
array

Definition at line 473 of file BeanModel.php.

static getAttributeNamesNotBelongsToOrManyManyForModel (  )  [static, protected]
Returns:
array

Definition at line 485 of file BeanModel.php.

static getRelationNameToRelationTypeModelClassNameAndOwnsForModel (  )  [static, protected]
Returns:
array

Definition at line 497 of file BeanModel.php.

static getDerivedRelationNameToTypeModelClassNameAndOppposingRelationForModel (  )  [static, protected]
Returns:
array

Definition at line 509 of file BeanModel.php.

static forgetBeanModel ( modelClassName  )  [static, protected]
Parameters:
string $modelClassName

Definition at line 521 of file BeanModel.php.

static isRelationTypeAManyManyVariant ( relationName  )  [static]
Parameters:
string $relationName
Returns:
bool

Definition at line 717 of file BeanModel.php.


Field Documentation

const HAS_ONE_BELONGS_TO = 0

Used in an extending class's getDefaultMetadata() method to specify that a relation is 1:1 and that the class on the side of the relationship where this is not a column in that model's table. Example: model X HAS_ONE Y. There will be a y_id on the x table. But in Y you would have HAS_ONE_BELONGS_TO X and there would be no column in the y table.

Definition at line 48 of file BeanModel.php.

Used in an extending class's getDefaultMetadata() method to specify that a relation is 1:M and that the class on the M side of the relation. Note: Currently if you have a relation that is set to HAS_MANY_BELONGS_TO, then that relation name must be the strtolower() same as the related model class name. This is the current support for this relation type. If something different is set, an exception will be thrown.

Definition at line 58 of file BeanModel.php.

const HAS_ONE = 2

Used in an extending class's getDefaultMetadata() method to specify that a relation is 1:1.

Definition at line 64 of file BeanModel.php.

const HAS_MANY = 3

Used in an extending class's getDefaultMetadata() method to specify that a relation is 1:M and that the class is on the 1 side of the relation.

Definition at line 71 of file BeanModel.php.

const MANY_MANY = 4

Used in an extending class's getDefaultMetadata() method to specify that a relation is M:N and that the class on the either side of the relation.

Definition at line 78 of file BeanModel.php.

const OWNED = true

Used in an extending class's getDefaultMetadata() method to specify that a 1:1 or 1:M relation is one in which the left side of the relation owns the model or models on the right side, meaning that if the model is deleted it owns the related models and they are deleted along with it. If not specified the related model is independent and is not deleted.

Definition at line 87 of file BeanModel.php.

$lastClassInBeanHeirarchy = 'BeanModel' [static, protected]
See also:
RedBeanModel::$lastClassInBeanHeirarchy

Reimplemented in CustomFieldsModel, RedBeanModel, and OwnedModel.

Definition at line 126 of file BeanModel.php.


The documentation for this class was generated from the following file:
 All Data Structures Functions Variables
Generated on Sun Dec 17 07:10:22 2017