Class DefaultDataProvider.

Default implementation for a data provider using the Contao default database as backend.
SuppressWarnings (PHPMD.ExcessiveClassComplexity) - There is no way to reduce this class more without reducing the interface.

 Methods

Create a new instance of the data provider.

__construct() 

{@inheritDoc}

delete($item) 

Parameters

$item

Exceptions

\ContaoCommunityAlliance\DcGeneral\Exception\DcGeneralRuntimeException When an unusable object has been passed.

Create an instance of the default database driven uuid generator.

enableDefaultUuidGenerator() : \ContaoCommunityAlliance\DcGeneral\Data\DefaultDataProvider

Exceptions

\RuntimeException When already an id generator has been set on the instance.

Returns

{@inheritDoc}

fetch(\ContaoCommunityAlliance\DcGeneral\Data\ConfigInterface $objConfig) 

Parameters

$objConfig

{@inheritDoc}

fetchAll(\ContaoCommunityAlliance\DcGeneral\Data\ConfigInterface $objConfig) 

Parameters

$objConfig

{@inheritDoc}

fieldExists($strField) 

Parameters

$strField

Retrieve the current active version for a row.

getActiveVersion(mixed $mixID) : mixed

Parameters

$mixID

mixed

The ID of the row.

Returns

mixedThe current version number of the requested row.

{@inheritDoc}

getCount(\ContaoCommunityAlliance\DcGeneral\Data\ConfigInterface $objConfig) 

Parameters

$objConfig

{@inheritDoc}

getEmptyCollection() 

{@inheritDoc}

getEmptyConfig() 

{@inheritDoc}

getEmptyFilterOptionCollection() 

{@inheritDoc}

getEmptyModel() 

{@inheritDoc}

getFilterOptions(\ContaoCommunityAlliance\DcGeneral\Data\ConfigInterface $objConfig) 

Parameters

$objConfig

Exceptions

\ContaoCommunityAlliance\DcGeneral\Exception\DcGeneralRuntimeException if improper values have been passed (i.e. not exactly one field requested).

Get the property name that shall get updated with the current time stamp when saving to the database.

getTimeStampProperty() : string | null

Returns

stringnull

{@inheritDoc}

getVersion($mixID, $mixVersion) 

Parameters

$mixID

$mixVersion

Return a list with all versions for the row with the given Id.

getVersions(mixed $mixID, boolean $blnOnlyActive) : \ContaoCommunityAlliance\DcGeneral\Data\CollectionInterface

Parameters

$mixID

mixed

The ID of the row.

$blnOnlyActive

boolean

If true, only active versions will get returned, if false all version will get returned.

Returns

{@inheritDoc}

isUniqueValue($strField, $varNew, $intId) 

Parameters

$strField

$varNew

$intId

{@inheritDoc}

resetFallback($strField) 

Parameters

$strField

Check if two models have the same values in all properties.

sameModels(\ContaoCommunityAlliance\DcGeneral\Data\ModelInterface $objModel1, \ContaoCommunityAlliance\DcGeneral\Data\ModelInterface $objModel2) : boolean

Parameters

$objModel1

\ContaoCommunityAlliance\DcGeneral\Data\ModelInterface

The first model to compare.

$objModel2

\ContaoCommunityAlliance\DcGeneral\Data\ModelInterface

The second model to compare.

Returns

booleanTrue - If both models are same, false if not.

{@inheritDoc}

save(\ContaoCommunityAlliance\DcGeneral\Data\ModelInterface $objItem) 

Parameters

$objItem

{@inheritDoc}

saveEach(\ContaoCommunityAlliance\DcGeneral\Data\CollectionInterface $objItems) 

Parameters

$objItems

Save a new version of a row.

saveVersion(\ContaoCommunityAlliance\DcGeneral\Data\ModelInterface $objModel, string $strUsername) : void

Parameters

$objModel

\ContaoCommunityAlliance\DcGeneral\Data\ModelInterface

The model for which a new version shall be created.

$strUsername

string

The username to attach to the version as creator.

{@inheritDoc}

setBaseConfig(array $arrConfig) 

Parameters

$arrConfig

Exceptions

\ContaoCommunityAlliance\DcGeneral\Exception\DcGeneralRuntimeException When no source has been defined.

Set the id generator to use.

setIdGenerator(\ContaoCommunityAlliance\DcGeneral\Data\IdGeneratorInterface $idGenerator) : \ContaoCommunityAlliance\DcGeneral\Data\DefaultDataProvider

Set the property name that shall get updated with the current time stamp when saving to the database.

setTimeStampProperty(boolean $timeStampField) : \ContaoCommunityAlliance\DcGeneral\Data\DefaultDataProvider

Parameters

$timeStampField

boolean

The property name or empty to clear.

Returns

Set a version as active.

setVersionActive(mixed $mixID, mixed $mixVersion) : void

Parameters

$mixID

mixed

The ID of the row.

$mixVersion

mixed

The version number to set active.

 Properties