GameCollection Class Reference

Inheritance diagram for GameCollection:
Item CustomFieldsModel RedBeanModel BeanModel ObservableComponent

Public Member Functions

 __toString ()
 getUnserializedData ()
 getItemsData ()
 setItemsData ($itemsData)
 getRedemptionCount ()
 setRedemptionCount ($redemptionCount)
 redeem ()
 canRedeem ()

Static Public Member Functions

static resolveByTypeAndPerson ($type, Item $person)
static resolvePersonAndAvailableTypes (Item $person, $collectionTypes)
static getModuleClassName ()
static canSaveMetadata ()
static getDefaultMetadata ()
static isTypeDeletable ()
static getAvailableTypesCacheIdentifier ()
static getAvailableTypes ()
static shouldReceiveCollectionItem ()
static processRandomReceivingCollectionItemByUser (User $user)
static getARandomCollectionItemForUser (User $user)

Static Protected Member Functions

static getLabel ($language=null)
static getPluralLabel ($language=null)

Detailed Description

Model for game collections.

Definition at line 40 of file GameCollection.php.


Member Function Documentation

__toString (  ) 

Returns the displayable string for the class. Should be overridden in any model that can provide a meaningful string representation of itself.

Returns:
A string.

Reimplemented from RedBeanModel.

Definition at line 42 of file GameCollection.php.

static resolveByTypeAndPerson ( type,
Item person 
) [static]

Given a collection type and Item (Either User or Person), try to find an existing model. If the model does not exist, create it and populate the Item and type.

Parameters:
string $type
Item $person
Returns:
The found or created model.
Exceptions:
NotSupportedException 

Definition at line 59 of file GameCollection.php.

static resolvePersonAndAvailableTypes ( Item person,
collectionTypes 
) [static]

Given an Item (Either User or Person), try to find an existing model for each type. If the model does not exist, create it and populate the Item and type.

Returns:
models found or created indexed by type.
Parameters:
Item $person
$collectionTypes 
Returns:
array
Exceptions:
FailedToSaveModelException 

Definition at line 106 of file GameCollection.php.

static canSaveMetadata (  )  [static]

By default models cannot save their metadata, allowing them to be loaded quickly because the loading of of metadata can be avoided as much as possible. To make a model able to save its metadata override this method to return true. PUT it before the getDefaultMetadata in the derived class.

Reimplemented from RedBeanModel.

Definition at line 160 of file GameCollection.php.

static getDefaultMetadata (  )  [static]

Returns the default meta data for the class. It must be appended to the meta data from the parent model, if any.

Reimplemented from Item.

Definition at line 165 of file GameCollection.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 Item.

Definition at line 197 of file GameCollection.php.

static shouldReceiveCollectionItem (  )  [static]

Randomly decide if the user should receive a collection item

Returns:
bool

Definition at line 236 of file GameCollection.php.

static processRandomReceivingCollectionItemByUser ( User user  )  [static]

Process receiving a collection item

Parameters:
User $user
Exceptions:
FailedToSaveModelException 
Returns:
string $randomKey representing CollectionItem type

Definition at line 252 of file GameCollection.php.

static getARandomCollectionItemForUser ( User user  )  [static]

Get a random collection item that can be collected by user

Parameters:
User $user
Returns:
array

Definition at line 271 of file GameCollection.php.

static getLabel ( language = null  )  [static, protected]

Returns the display name for the model class.

Parameters:
null | string $language
Returns:
dynamic label name based on module.

Reimplemented from RedBeanModel.

Definition at line 286 of file GameCollection.php.

static getPluralLabel ( language = null  )  [static, protected]

Returns the display name for plural of the model class.

Parameters:
null | string $language
Returns:
dynamic label name based on module.

Reimplemented from RedBeanModel.

Definition at line 296 of file GameCollection.php.

getItemsData (  ) 
Returns:
array

Definition at line 313 of file GameCollection.php.


The documentation for this class was generated from the following file:
 All Data Structures Functions Variables
Generated on Fri Oct 20 07:10:25 2017