PHP Класс MetaModels\DcGeneral\Data\Driver

Наследование: implements ContaoCommunityAlliance\DcGeneral\Data\MultiLanguageDataProviderInterface
Показать файл Открыть проект

Защищенные свойства (Protected)

Свойство Тип Описание
$metaModel MetaModels\IMetaModel The MetaModel this DataContainer is working on.
$serviceContainer MetaModels\IMetaModelsServiceContainer The service container.
$strCurrentLanguage string The current active language.
$strTable string Name of current table.

Открытые методы

Метод Описание
createVariant ( ContaoCommunityAlliance\DcGeneral\Data\ConfigInterface $objConfig ) : null | ContaoCommunityAlliance\DcGeneral\Data\ModelInterface Fetch a variant of a single record by id.
delete ( mixed $varItem ) : void Delete an item.
fetch ( ContaoCommunityAlliance\DcGeneral\Data\ConfigInterface $objConfig ) : null | ContaoCommunityAlliance\DcGeneral\Data\ModelInterface Fetch a single or first record by id or filter.
fetchAll ( ContaoCommunityAlliance\DcGeneral\Data\ConfigInterface $objConfig ) : ContaoCommunityAlliance\DcGeneral\Data\CollectionInterface Fetch all records (optional filtered, sorted and limited).
fieldExists ( string $strField ) : boolean Check if the attribute exists in the table and holds a value.
getActiveVersion ( mixed $mixID ) : void Return the active version from a record.
getCount ( ContaoCommunityAlliance\DcGeneral\Data\ConfigInterface $objConfig ) : integer Return the amount of total items (filtering may be used in the config).
getCurrentLanguage ( ) : string Get the current working language.
getEmptyCollection ( ) : ContaoCommunityAlliance\DcGeneral\Data\CollectionInterface Fetch an empty collection.
getEmptyConfig ( ) : ContaoCommunityAlliance\DcGeneral\Data\ConfigInterface Return empty config object.
getEmptyModel ( ) : ContaoCommunityAlliance\DcGeneral\Data\ModelInterface Fetch an empty single record (new item).
getFallbackLanguage ( $mixID )
getFilterOptions ( ContaoCommunityAlliance\DcGeneral\Data\ConfigInterface $objConfig ) : ContaoCommunityAlliance\DcGeneral\Data\FilterOptionCollectionInterface Retrieve all unique values for the given property.
getLanguages ( $mixID )
getVersion ( mixed $mixID, mixed $mixVersion ) : void Return a model based of the version information.
getVersions ( mixed $mixID, boolean $blnOnlyActive = false ) : ContaoCommunityAlliance\DcGeneral\Data\CollectionInterface Return a list with all versions for the model with the given Id.
isUniqueValue ( string $strField, mixed $varNew, integer $intId = null ) : boolean Determine if a given value is unique within the metamodel.
resetFallback ( string $strField ) : void Reset the fallback field.
sameModels ( ContaoCommunityAlliance\DcGeneral\Data\ModelInterface $objModel1, ContaoCommunityAlliance\DcGeneral\Data\ModelInterface $objModel2 ) : boolean Check if two models have the same values in all properties.
save ( ContaoCommunityAlliance\DcGeneral\Data\ModelInterface $objItem ) : ContaoCommunityAlliance\DcGeneral\Data\ModelInterface Save an item to the data provider.
saveEach ( ContaoCommunityAlliance\DcGeneral\Data\CollectionInterface $objItems ) : void Save a collection of items to the data provider.
saveVersion ( ContaoCommunityAlliance\DcGeneral\Data\ModelInterface $objModel, string $strUsername ) : void Save a new Version of a record.
setBaseConfig ( array $arrConfig ) : void Set base config with source and other necessary parameter.
setCurrentLanguage ( string $strLanguage ) : void Set the current working language for the whole data provider.
setVersionActive ( mixed $mixID, mixed $mixVersion ) : void Set a version as active.

Защищенные методы

Метод Описание
extractSorting ( ContaoCommunityAlliance\DcGeneral\Data\ConfigInterface $config ) : array Extract the sorting from the given config.
getDatabase ( ) : Database Retrieve the Database.
getIdsFromFilter ( MetaModels\Filter\IFilter $filter, ContaoCommunityAlliance\DcGeneral\Data\ConfigInterface $config ) : string[] Fetch the ids via the given filter.
getItemsFromFilter ( MetaModels\Filter\IFilter $filter, ContaoCommunityAlliance\DcGeneral\Data\ConfigInterface $config ) : MetaModels\IItems | MetaModels\IItem[] Fetch the items via the given filter.
getMetaModel ( ) : MetaModels\IMetaModel Retrieve the MetaModel.
getServiceContainer ( ) : MetaModels\IMetaModelsServiceContainer Retrieve the service container.
prepareFilter ( ContaoCommunityAlliance\DcGeneral\Data\ConfigInterface $configuration ) : MetaModels\Filter\IFilter Prepare a filter and return it.
setLanguage ( string $language = '' ) : string Set a language as active language in Contao and return the previous language.

Описание методов

createVariant() публичный Метод

Fetch a variant of a single record by id.
public createVariant ( ContaoCommunityAlliance\DcGeneral\Data\ConfigInterface $objConfig ) : null | ContaoCommunityAlliance\DcGeneral\Data\ModelInterface
$objConfig ContaoCommunityAlliance\DcGeneral\Data\ConfigInterface The config holding the id of the base model.
Результат null | ContaoCommunityAlliance\DcGeneral\Data\ModelInterface

delete() публичный Метод

The given value may be either integer, string or an instance of Model
public delete ( mixed $varItem ) : void
$varItem mixed Id or the model itself, to delete.
Результат void

extractSorting() защищенный Метод

Extract the sorting from the given config.
protected extractSorting ( ContaoCommunityAlliance\DcGeneral\Data\ConfigInterface $config ) : array
$config ContaoCommunityAlliance\DcGeneral\Data\ConfigInterface The configuration to be applied.
Результат array

fetch() публичный Метод

If the model shall be retrieved by id, use $objConfig->setId() to populate the config with an Id. If the model shall be retrieved by filter, use $objConfig->setFilter() to populate the config with a filter.
public fetch ( ContaoCommunityAlliance\DcGeneral\Data\ConfigInterface $objConfig ) : null | ContaoCommunityAlliance\DcGeneral\Data\ModelInterface
$objConfig ContaoCommunityAlliance\DcGeneral\Data\ConfigInterface The config to use.
Результат null | ContaoCommunityAlliance\DcGeneral\Data\ModelInterface

fetchAll() публичный Метод

Fetch all records (optional filtered, sorted and limited).
public fetchAll ( ContaoCommunityAlliance\DcGeneral\Data\ConfigInterface $objConfig ) : ContaoCommunityAlliance\DcGeneral\Data\CollectionInterface
$objConfig ContaoCommunityAlliance\DcGeneral\Data\ConfigInterface The configuration to be applied.
Результат ContaoCommunityAlliance\DcGeneral\Data\CollectionInterface

fieldExists() публичный Метод

Check if the attribute exists in the table and holds a value.
public fieldExists ( string $strField ) : boolean
$strField string The name of the attribute that shall be tested.
Результат boolean

getActiveVersion() публичный Метод

Return the active version from a record.
public getActiveVersion ( mixed $mixID ) : void
$mixID mixed The ID of the record.
Результат void

getCount() публичный Метод

Return the amount of total items (filtering may be used in the config).
public getCount ( ContaoCommunityAlliance\DcGeneral\Data\ConfigInterface $objConfig ) : integer
$objConfig ContaoCommunityAlliance\DcGeneral\Data\ConfigInterface The filter config options.
Результат integer

getCurrentLanguage() публичный Метод

Get the current working language.
public getCurrentLanguage ( ) : string
Результат string Short tag for the current working language like de or fr etc.

getDatabase() защищенный Метод

Retrieve the Database.
protected getDatabase ( ) : Database
Результат Contao\Database

getEmptyCollection() публичный Метод

Fetch an empty collection.
public getEmptyCollection ( ) : ContaoCommunityAlliance\DcGeneral\Data\CollectionInterface
Результат ContaoCommunityAlliance\DcGeneral\Data\CollectionInterface

getEmptyConfig() публичный Метод

Return empty config object.
public getEmptyConfig ( ) : ContaoCommunityAlliance\DcGeneral\Data\ConfigInterface
Результат ContaoCommunityAlliance\DcGeneral\Data\ConfigInterface

getEmptyModel() публичный Метод

Fetch an empty single record (new item).
public getEmptyModel ( ) : ContaoCommunityAlliance\DcGeneral\Data\ModelInterface
Результат ContaoCommunityAlliance\DcGeneral\Data\ModelInterface

getFallbackLanguage() публичный Метод

public getFallbackLanguage ( $mixID )

getFilterOptions() публичный Метод

The result set will be an array containing all unique values contained in the MetaModel for the defined attribute in the configuration. Note: this only re-ensembles really used values for at least one data set. The only information being interpreted from the passed config object is the first property to fetch and the filter definition.
public getFilterOptions ( ContaoCommunityAlliance\DcGeneral\Data\ConfigInterface $objConfig ) : ContaoCommunityAlliance\DcGeneral\Data\FilterOptionCollectionInterface
$objConfig ContaoCommunityAlliance\DcGeneral\Data\ConfigInterface The filter config options.
Результат ContaoCommunityAlliance\DcGeneral\Data\FilterOptionCollectionInterface

getIdsFromFilter() защищенный Метод

Fetch the ids via the given filter.
protected getIdsFromFilter ( MetaModels\Filter\IFilter $filter, ContaoCommunityAlliance\DcGeneral\Data\ConfigInterface $config ) : string[]
$filter MetaModels\Filter\IFilter The filter.
$config ContaoCommunityAlliance\DcGeneral\Data\ConfigInterface The configuration to be applied.
Результат string[]

getItemsFromFilter() защищенный Метод

Fetch the items via the given filter.
protected getItemsFromFilter ( MetaModels\Filter\IFilter $filter, ContaoCommunityAlliance\DcGeneral\Data\ConfigInterface $config ) : MetaModels\IItems | MetaModels\IItem[]
$filter MetaModels\Filter\IFilter The filter.
$config ContaoCommunityAlliance\DcGeneral\Data\ConfigInterface The configuration to be applied.
Результат MetaModels\IItems | MetaModels\IItem[] The collection of IItem instances that match the given filter.

getLanguages() публичный Метод

public getLanguages ( $mixID )

getMetaModel() защищенный Метод

Retrieve the MetaModel.
protected getMetaModel ( ) : MetaModels\IMetaModel
Результат MetaModels\IMetaModel

getServiceContainer() защищенный Метод

Retrieve the service container.
protected getServiceContainer ( ) : MetaModels\IMetaModelsServiceContainer
Результат MetaModels\IMetaModelsServiceContainer

getVersion() публичный Метод

Return a model based of the version information.
public getVersion ( mixed $mixID, mixed $mixVersion ) : void
$mixID mixed The ID of record.
$mixVersion mixed The ID of the version.
Результат void

getVersions() публичный Метод

Return a list with all versions for the model with the given Id.
public getVersions ( mixed $mixID, boolean $blnOnlyActive = false ) : ContaoCommunityAlliance\DcGeneral\Data\CollectionInterface
$mixID mixed The ID of the row.
$blnOnlyActive boolean If true, only active versions will get returned, if false all version will get returned.
Результат ContaoCommunityAlliance\DcGeneral\Data\CollectionInterface

isUniqueValue() публичный Метод

Determine if a given value is unique within the metamodel.
public isUniqueValue ( string $strField, mixed $varNew, integer $intId = null ) : boolean
$strField string The attribute name.
$varNew mixed The value that shall be checked.
$intId integer The (optional) id of the item currently in scope - pass null for new items.
Результат boolean True if the values is not yet contained within the table, false otherwise.

prepareFilter() защищенный Метод

Prepare a filter and return it.
protected prepareFilter ( ContaoCommunityAlliance\DcGeneral\Data\ConfigInterface $configuration ) : MetaModels\Filter\IFilter
$configuration ContaoCommunityAlliance\DcGeneral\Data\ConfigInterface The configuration.
Результат MetaModels\Filter\IFilter

resetFallback() публичный Метод

This clears the given property in all items in the data provider to an empty value.
public resetFallback ( string $strField ) : void
$strField string The field to reset.
Результат void

sameModels() публичный Метод

Check if two models have the same values in all properties.
public sameModels ( ContaoCommunityAlliance\DcGeneral\Data\ModelInterface $objModel1, ContaoCommunityAlliance\DcGeneral\Data\ModelInterface $objModel2 ) : boolean
$objModel1 ContaoCommunityAlliance\DcGeneral\Data\ModelInterface The first model to compare.
$objModel2 ContaoCommunityAlliance\DcGeneral\Data\ModelInterface The second model to compare.
Результат boolean True - If both models are same, false if not.

save() публичный Метод

If the item does not have an Id yet, the save operation will add it as a new row to the database and populate the Id of the model accordingly.
public save ( ContaoCommunityAlliance\DcGeneral\Data\ModelInterface $objItem ) : ContaoCommunityAlliance\DcGeneral\Data\ModelInterface
$objItem ContaoCommunityAlliance\DcGeneral\Data\ModelInterface The model to save back.
Результат ContaoCommunityAlliance\DcGeneral\Data\ModelInterface The passed model.

saveEach() публичный Метод

Save a collection of items to the data provider.
public saveEach ( ContaoCommunityAlliance\DcGeneral\Data\CollectionInterface $objItems ) : void
$objItems ContaoCommunityAlliance\DcGeneral\Data\CollectionInterface The collection containing all items to be saved.
Результат void

saveVersion() публичный Метод

Save a new Version of a record.
public saveVersion ( ContaoCommunityAlliance\DcGeneral\Data\ModelInterface $objModel, string $strUsername ) : void
$objModel ContaoCommunityAlliance\DcGeneral\Data\ModelInterface The model to be saved.
$strUsername string The username that creates the new version.
Результат void

setBaseConfig() публичный Метод

Set base config with source and other necessary parameter.
public setBaseConfig ( array $arrConfig ) : void
$arrConfig array The configuration to use.
Результат void

setCurrentLanguage() публичный Метод

Set the current working language for the whole data provider.
public setCurrentLanguage ( string $strLanguage ) : void
$strLanguage string The new language, use short tag "2 chars like de, fr etc.".
Результат void

setLanguage() защищенный Метод

Set a language as active language in Contao and return the previous language.
protected setLanguage ( string $language = '' ) : string
$language string The language to set (if any).
Результат string

setVersionActive() публичный Метод

Set a version as active.
public setVersionActive ( mixed $mixID, mixed $mixVersion ) : void
$mixID mixed The ID of record.
$mixVersion mixed The ID of the version.
Результат void

Описание свойств

$metaModel защищенное свойство

The MetaModel this DataContainer is working on.
protected IMetaModel,MetaModels $metaModel
Результат MetaModels\IMetaModel

$serviceContainer защищенное свойство

The service container.
protected IMetaModelsServiceContainer,MetaModels $serviceContainer
Результат MetaModels\IMetaModelsServiceContainer

$strCurrentLanguage защищенное свойство

The current active language.
protected string $strCurrentLanguage
Результат string

$strTable защищенное свойство

Name of current table.
protected string $strTable
Результат string