Class DefaultModel.

Reference implementation of a dumb model.

 Methods

Copy this model, without the id.

__clone() : void

Get the id for this model.

getID() : string

Returns

stringThe ID for this model.

Get an iterator for this model's property values.

getIterator() : \IteratorAggregate

Fetch all properties from the model as an name => value array.

getPropertiesAsArray() : array

Returns

array

Fetch the property with the given name from the model.

getProperty(string $strPropertyName) : mixed
This method returns null if an unknown property is retrieved.

Parameters

$strPropertyName

string

The property name to be retrieved.

Returns

mixedThe value of the given property.

Return the data provider name.

getProviderName() : string

Returns

stringthe name of the corresponding data provider.

Check if this model have any properties.

hasProperties() : boolean

Returns

booleantrue if any property has been stored, false otherwise.

{@inheritDoc}

readFromPropertyValueBag(\ContaoCommunityAlliance\DcGeneral\Data\PropertyValueBagInterface $valueBag) 

Parameters

$valueBag

Exceptions

\ContaoCommunityAlliance\DcGeneral\Exception\DcGeneralInvalidArgumentException When a property in the value bag has been marked as invalid.

Set the id for this object.

setID(mixed $mixID) : void
NOTE: when the Id has been set once to a non null value, it can NOT be changed anymore. Normally this should only be called from inside of the implementing provider.

Parameters

$mixID

mixed

Could be a integer, string or anything else - depends on the provider implementation.

Update all properties in the model.

setPropertiesAsArray(array $arrProperties) : void

Parameters

$arrProperties

array

The property values as name => value pairs.

Update the property value in the model.

setProperty(string $strPropertyName, mixed $varValue) : void

Parameters

$strPropertyName

string

The property name to be set.

$varValue

mixed

The value to be set.

Update the property value in the model.

setPropertyRaw(string $strPropertyName, mixed $varValue) : void
This method is not interfaced and MUST only be used for initial values from the data provider.

Parameters

$strPropertyName

string

The property name to be set.

$varValue

mixed

The value to be set.

Sets the provider name in the model.

setProviderName(string $strProviderName) : void
NOTE: this is intended to be used by the data provider only and not by any user. Changing this by hand may cause unexpected behaviour. So DO NOT USE IT. For this reason, this method is not interfaced, as only the data provider knows how to set itself to the model.

Parameters

$strProviderName

string

The name of the corresponding data provider.

{@inheritDoc}

writeToPropertyValueBag(\ContaoCommunityAlliance\DcGeneral\Data\PropertyValueBagInterface $valueBag) 

Parameters

$valueBag

 Properties

 

A list with all properties.

$arrProperties : array
 

The Id of this model.

$mixID : mixed
 

The name of the corresponding data provider.

$strProviderName : string