Property | Type | Description | |
---|---|---|---|
$arrAttributes | array | Association is $colName => object | |
$arrData | array | This is the data from tl_metamodel. | |
$serviceContainer | metamodels\IMetaModelsServiceContainer | The service container. |
Method | Description | |
---|---|---|
__construct ( array $arrData ) | Instantiate a MetaModel. | |
addAttribute ( MetaModels\Attribute\IAttribute $objAttribute ) | ||
delete ( metamodels\IItem $objItem ) | ||
findByFilter ( $objFilter, $strSortBy = '', $intOffset, $intLimit, $strSortOrder = 'ASC', $arrAttrOnly = [] ) | ||
findById ( $intId, $arrAttrOnly = [] ) | ||
findVariantBase ( $objFilter ) | ||
findVariants ( $arrIds, $objFilter ) | ||
findVariantsWithBase ( $arrIds, $objFilter ) | ||
get ( $strKey ) | ||
getActiveLanguage ( ) | ||
getAttribute ( $strAttributeName ) | ||
getAttributeById ( $intId ) | ||
getAttributeOptions ( $strAttribute, $objFilter = null ) | ||
getAttributes ( ) | ||
getAvailableLanguages ( ) | ||
getCount ( $objFilter ) | ||
getEmptyFilter ( ) | ||
getFallbackLanguage ( ) | ||
getIdsFromFilter ( $objFilter, $strSortBy = '', $intOffset, $intLimit, $strSortOrder = 'ASC' ) | ||
getInVariantAttributes ( ) | ||
getName ( ) | ||
getServiceContainer ( ) | ||
getTableName ( ) | ||
getView ( $intViewId ) | ||
hasAttribute ( $strAttributeName ) | ||
hasVariants ( ) | ||
isTranslated ( ) | ||
prepareFilter ( $intFilterSettings, $arrFilterUrl ) | ||
saveItem ( $objItem ) | ||
setServiceContainer ( metamodels\IMetaModelsServiceContainer $serviceContainer ) : |
Set the service container. |
Method | Description | |
---|---|---|
buildDatabaseParameterList ( array $parameters ) : string | Build a list of the correct amount of "?" for use in a db query. | |
convertRowsToResult ( Database\Result $objRow, string[] $arrAttrOnly = [] ) : array | Convert a database result to a result array. | |
copyFilter ( MetaModels\Filter\IFilter | null $objFilter ) : MetaModels\Filter\IFilter | Clone the given filter or create an empty one if no filter has been passed. | |
createNewItem ( metamodels\IItem $item ) : void | Create a new item in the database. | |
fetchAdditionalAttributes ( string[] $ids, array $result, string[] $attrOnly = [] ) : array | This method is called to retrieve the data for certain items from the database. | |
fetchRows ( string[] $arrIds, string[] $arrAttrOnly = [] ) : array | Fetch the "native" database rows with the given ids. | |
fetchTranslatedAttributeValues ( MetaModels\Attribute\ITranslated $attribute, string[] $ids ) : array | This method is called to retrieve the data for certain items from the database. | |
getAttributeByNames ( string[] $attrNames = [] ) : MetaModels\Attribute\IAttribute[] | Retrieve all attributes with the given names. | |
getAttributeImplementing ( string $interface ) : array | Retrieve all attributes implementing the given interface. | |
getComplexAttributes ( ) : MetaModels\Attribute\IComplex[] | This method retrieves all complex attributes from the current MetaModel. | |
getDatabase ( ) : |
Retrieve the database instance to use. | |
getItemsWithId ( int[] $arrIds, string[] $arrAttrOnly = [] ) : MetaModels\IItems | This method is called to retrieve the data for certain items from the database. | |
getMatchingIds ( MetaModels\Filter\IFilter | null $objFilter ) : array | Narrow down the list of Ids that match the given filter. | |
getSimpleAttributes ( ) : MetaModels\Attribute\ISimple[] | This method retrieves all simple attributes from the current MetaModel. | |
getTranslatedAttributes ( ) : MetaModels\Attribute\ITranslated[] | This method retrieves all translated attributes from the current MetaModel. | |
isComplexAttribute ( MetaModels\Attribute\IAttribute $objAttribute ) : boolean | Determine if the given attribute is a complex one. | |
isSimpleAttribute ( MetaModels\Attribute\IAttribute $objAttribute ) : boolean | Determine if the given attribute is a simple one. | |
isTranslatedAttribute ( MetaModels\Attribute\IAttribute $objAttribute ) : boolean | Determine if the given attribute is a translated one. | |
saveAttribute ( MetaModels\Attribute\IAttribute $objAttribute, array $arrIds, mixed $varData, string $strLangCode ) : void | Update an attribute for the given ids with the given data. | |
saveSimpleColumn ( string $strColumn, array $arrIds, mixed $varData ) : void | Update the value of a native column for the given ids with the given data. | |
tryUnserialize ( string $value ) : mixed | Try to unserialize a value. | |
updateVariants ( metamodels\IItem $item, string $activeLanguage, int[] $allIds, boolean $baseAttributes = false ) : void | Update the variants with the value if needed. |
public __construct ( array $arrData ) | ||
$arrData | array | The information array, for information on the available columns, refer to documentation of table tl_metamodel. |
public addAttribute ( MetaModels\Attribute\IAttribute $objAttribute ) | ||
$objAttribute | MetaModels\Attribute\IAttribute |
protected buildDatabaseParameterList ( array $parameters ) : string | ||
$parameters | array | The parameters. |
return | string |
protected convertRowsToResult ( Database\Result $objRow, string[] $arrAttrOnly = [] ) : array | ||
$objRow | Database\Result | The database result. |
$arrAttrOnly | string[] | The list of attributes to return, if any. |
return | array |
protected copyFilter ( MetaModels\Filter\IFilter | null $objFilter ) : MetaModels\Filter\IFilter | ||
$objFilter | MetaModels\Filter\IFilter | null | The filter to clone. |
return | MetaModels\Filter\IFilter | the cloned filter. |
protected createNewItem ( metamodels\IItem $item ) : void | ||
$item | metamodels\IItem | The item to be created. |
return | void |
protected fetchAdditionalAttributes ( string[] $ids, array $result, string[] $attrOnly = [] ) : array | ||
$ids | string[] | The ids of the items to retrieve the order of ids is used for sorting of the return values. |
$result | array | The current values. |
$attrOnly | string[] | Names of the attributes that shall be contained in the result, defaults to array() which means all attributes. |
return | array | an array of all matched items, sorted by the id list. |
protected fetchRows ( string[] $arrIds, string[] $arrAttrOnly = [] ) : array | ||
$arrIds | string[] | The ids of the items to retrieve the order of ids is used for sorting of the return values. |
$arrAttrOnly | string[] | Names of the attributes that shall be contained in the result, defaults to array() which means all attributes. |
return | array | an array containing the database rows with each column "deserialized". |
protected fetchTranslatedAttributeValues ( MetaModels\Attribute\ITranslated $attribute, string[] $ids ) : array | ||
$attribute | MetaModels\Attribute\ITranslated | The attribute to fetch the values for. |
$ids | string[] | The ids of the items to retrieve the order of ids is used for sorting of the return values. |
return | array | an array of all matched items, sorted by the id list. |
public findByFilter ( $objFilter, $strSortBy = '', $intOffset, $intLimit, $strSortOrder = 'ASC', $arrAttrOnly = [] ) |
public getActiveLanguage ( ) |
protected getAttributeByNames ( string[] $attrNames = [] ) : MetaModels\Attribute\IAttribute[] | ||
$attrNames | string[] | The attribute names, if empty all attributes will be returned. |
return | MetaModels\Attribute\IAttribute[] |
protected getAttributeImplementing ( string $interface ) : array | ||
$interface | string | The interface name. |
return | array |
protected getComplexAttributes ( ) : MetaModels\Attribute\IComplex[] | ||
return | MetaModels\Attribute\IComplex[] | all complex attributes defined for this instance. |
protected getDatabase ( ) : |
||
return |
public getIdsFromFilter ( $objFilter, $strSortBy = '', $intOffset, $intLimit, $strSortOrder = 'ASC' ) |
protected getItemsWithId ( int[] $arrIds, string[] $arrAttrOnly = [] ) : MetaModels\IItems | ||
$arrIds | int[] | The ids of the items to retrieve the order of ids is used for sorting of the return values. |
$arrAttrOnly | string[] | Names of the attributes that shall be contained in the result, defaults to array() which means all attributes. |
return | MetaModels\IItems | a collection of all matched items, sorted by the id list. |
protected getMatchingIds ( MetaModels\Filter\IFilter | null $objFilter ) : array | ||
$objFilter | MetaModels\Filter\IFilter | null | The filter to search the matching ids for. |
return | array | all matching Ids. |
protected getSimpleAttributes ( ) : MetaModels\Attribute\ISimple[] | ||
return | MetaModels\Attribute\ISimple[] | all simple attributes defined for this instance. |
protected getTranslatedAttributes ( ) : MetaModels\Attribute\ITranslated[] | ||
return | MetaModels\Attribute\ITranslated[] | all translated attributes defined for this instance. |
protected isComplexAttribute ( MetaModels\Attribute\IAttribute $objAttribute ) : boolean | ||
$objAttribute | MetaModels\Attribute\IAttribute | The attribute to test. |
return | boolean | true if it is complex, false otherwise. |
protected isSimpleAttribute ( MetaModels\Attribute\IAttribute $objAttribute ) : boolean | ||
$objAttribute | MetaModels\Attribute\IAttribute | The attribute to test. |
return | boolean | true if it is simple, false otherwise. |
protected isTranslatedAttribute ( MetaModels\Attribute\IAttribute $objAttribute ) : boolean | ||
$objAttribute | MetaModels\Attribute\IAttribute | The attribute to test. |
return | boolean | true if it is translated, false otherwise. |
protected saveAttribute ( MetaModels\Attribute\IAttribute $objAttribute, array $arrIds, mixed $varData, string $strLangCode ) : void | ||
$objAttribute | MetaModels\Attribute\IAttribute | The attribute to save. |
$arrIds | array | The ids of the rows that shall be updated. |
$varData | mixed | The data to save in raw data. |
$strLangCode | string | The language code to save. |
return | void |
protected saveSimpleColumn ( string $strColumn, array $arrIds, mixed $varData ) : void | ||
$strColumn | string | The column name to update (i.e. tstamp). |
$arrIds | array | The ids of the rows that shall be updated. |
$varData | mixed | The data to save. If this is an array, it is automatically serialized. |
return | void |
public setServiceContainer ( metamodels\IMetaModelsServiceContainer $serviceContainer ) : |
||
$serviceContainer | metamodels\IMetaModelsServiceContainer | The service container. |
return |
protected tryUnserialize ( string $value ) : mixed | ||
$value | string | The string to process. |
return | mixed |
protected updateVariants ( metamodels\IItem $item, string $activeLanguage, int[] $allIds, boolean $baseAttributes = false ) : void | ||
$item | metamodels\IItem | The item to save. |
$activeLanguage | string | The language the values are in. |
$allIds | int[] | The ids of all variants. |
$baseAttributes | boolean | If also the base attributes get updated as well. |
return | void |
protected array $arrAttributes | ||
return | array |
protected array $arrData | ||
return | array |