PHP Класс MetaModels\Item

Наследование: implements metamodels\IItem
Показать файл Открыть проект Примеры использования класса

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

Свойство Тип Описание
$arrData array The data array containing the raw values obtained from the attributes.
$metaModel metamodels\IMetaModel Get's populated with the first call to getMetaModel() (lazy initialization).

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

Метод Описание
__construct ( metamodels\IMetaModel $objMetaModel, array $arrData ) Create a new instance.
buildJumpToLink ( MetaModels\Render\Setting\ICollection $objSettings ) : array Build the jumpTo link for use in templates.
copy ( ) : metamodels\IItem Returns a new item containing the same values as this item but no id.
get ( string $strAttributeName ) : mixed Return the native value of an attribute.
getAttribute ( string $strAttributeName ) : MetaModels\Attribute\IAttribute Fetch the MetaModel attribute instance with the given name.
getMetaModel ( ) : metamodels\IMetaModel Fetch the MetaModel that this item is originating from.
getServiceContainer ( ) : metamodels\IMetaModelsServiceContainer Retrieve the service container.
getSetAttributes ( ) : array Return a list of the col names from the attributes which are set.
getSiblings ( MetaModels\Filter\IFilter $objFilter ) : null | metamodels\IItems Find all Variants including the variant base.
getVariants ( MetaModels\Filter\IFilter $objFilter ) : metamodels\IItems Fetch the meta model variants for this item.
internalParseAttribute ( MetaModels\Attribute\IAttribute $objAttribute, string $strOutputFormat, MetaModels\Render\Setting\ICollection | null $objSettings ) : array Helper function for {@see MetaModelItem::parseValue()} and {@see MetaModelItem::parseAttribute()}.
isAttributeSet ( string $strAttributeName ) : boolean Check if the given attribute is set. This mean if in the data array is the filed set or not. If the attribute is not loaded the function will return false.
isVariant ( ) : boolean Determines if this item is a variant of another item.
isVariantBase ( ) : boolean Determines if this item is variant base of other items.
parseAttribute ( string $strAttributeName, string $strOutputFormat = 'text', MetaModels\Render\Setting\ICollection $objSettings = null ) : array Renders a single attribute in the given output format.
parseValue ( string $strOutputFormat = 'text', MetaModels\Render\Setting\ICollection $objSettings = null ) : array Renders the item in the given output format.
save ( ) : void Save the current data for every attribute to the data sink.
set ( string $strAttributeName, mixed $varValue ) : metamodels\IItem Set the native value of an Attribute.
varCopy ( ) : MetaModels\IItem Returns a new item containing the same values as this item but no id.

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

Метод Описание
getEventDispatcher ( ) : Symfony\Component\EventDispatcher\EventDispatcherInterface Retrieve the event dispatcher.
isArrayEmpty ( array $arrArray ) : boolean Run through each level of an array and check if we have at least one empty value.
isEmptyValue ( array $mixValue ) : boolean Check if a value is empty.
registerAssets ( MetaModels\Render\Setting\ICollection | null $objSettings ) : void Register the assets in Contao.

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

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

Create a new instance.
public __construct ( metamodels\IMetaModel $objMetaModel, array $arrData )
$objMetaModel metamodels\IMetaModel The model this item is represented by.
$arrData array The initial data that shall be injected into the new instance.

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

This is useful when creating new items that shall be based upon another item.
public copy ( ) : metamodels\IItem
Результат metamodels\IItem the new copy.

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

Return the native value of an attribute.
public get ( string $strAttributeName ) : mixed
$strAttributeName string The name of the attribute.
Результат mixed

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

Fetch the MetaModel attribute instance with the given name.
public getAttribute ( string $strAttributeName ) : MetaModels\Attribute\IAttribute
$strAttributeName string The name of the attribute.
Результат MetaModels\Attribute\IAttribute The instance.

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

Retrieve the event dispatcher.
protected getEventDispatcher ( ) : Symfony\Component\EventDispatcher\EventDispatcherInterface
Результат Symfony\Component\EventDispatcher\EventDispatcherInterface

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

Fetch the MetaModel that this item is originating from.
public getMetaModel ( ) : metamodels\IMetaModel
Результат metamodels\IMetaModel the instance.

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

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

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

Including all meta field as well.
public getSetAttributes ( ) : array
Результат array

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

The item itself is excluded from the return list.
public getSiblings ( MetaModels\Filter\IFilter $objFilter ) : null | metamodels\IItems
$objFilter MetaModels\Filter\IFilter The additional filter settings to apply.
Результат null | metamodels\IItems

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

Fetch the meta model variants for this item.
public getVariants ( MetaModels\Filter\IFilter $objFilter ) : metamodels\IItems
$objFilter MetaModels\Filter\IFilter The filter settings to be applied.
Результат metamodels\IItems A list of all variants for this item.

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

Helper function for {@see MetaModelItem::parseValue()} and {@see MetaModelItem::parseAttribute()}.
public internalParseAttribute ( MetaModels\Attribute\IAttribute $objAttribute, string $strOutputFormat, MetaModels\Render\Setting\ICollection | null $objSettings ) : array
$objAttribute MetaModels\Attribute\IAttribute The attribute to parse.
$strOutputFormat string The desired output format.
$objSettings MetaModels\Render\Setting\ICollection | null The settings object to be applied.
Результат array The parsed information for the given attribute.

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

Run through each level of an array and check if we have at least one empty value.
protected isArrayEmpty ( array $arrArray ) : boolean
$arrArray array The array to check.
Результат boolean True => empty, False => some values found.

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

Check if the given attribute is set. This mean if in the data array is the filed set or not. If the attribute is not loaded the function will return false.
public isAttributeSet ( string $strAttributeName ) : boolean
$strAttributeName string The desired attribute.
Результат boolean True means the data is set, on load of the item or at any time. False means the attribute is not set.

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

Check if a value is empty.
protected isEmptyValue ( array $mixValue ) : boolean
$mixValue array The value.
Результат boolean True => empty, false => found a valid values

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

Determines if this item is a variant of another item.
public isVariant ( ) : boolean
Результат boolean True if it is an variant, false otherwise.

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

Note: this does not mean that there actually exist variants of this item. It merely simply states, that this item is able to function as variant base for other items.
public isVariantBase ( ) : boolean
Результат boolean True if it is an variant base, false otherwise.

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

Renders a single attribute in the given output format.
public parseAttribute ( string $strAttributeName, string $strOutputFormat = 'text', MetaModels\Render\Setting\ICollection $objSettings = null ) : array
$strAttributeName string The desired attribute.
$strOutputFormat string The desired output format (optional - default: text).
$objSettings MetaModels\Render\Setting\ICollection The render settings to use (optional - default: null).
Результат array format=>value

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

Renders the item in the given output format.
public parseValue ( string $strOutputFormat = 'text', MetaModels\Render\Setting\ICollection $objSettings = null ) : array
$strOutputFormat string The desired output format (optional - default: text).
$objSettings MetaModels\Render\Setting\ICollection The render settings to use (optional - default: null).
Результат array attribute name => format => value

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

Register the assets in Contao.
protected registerAssets ( MetaModels\Render\Setting\ICollection | null $objSettings ) : void
$objSettings MetaModels\Render\Setting\ICollection | null The render settings to use.
Результат void

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

Save the current data for every attribute to the data sink.
public save ( ) : void
Результат void

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

Set the native value of an Attribute.
public set ( string $strAttributeName, mixed $varValue ) : metamodels\IItem
$strAttributeName string The name of the attribute.
$varValue mixed The value of the attribute.
Результат metamodels\IItem

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

Additionally, the item will be a variant child of this item. NOTE: if this item is not a variant base itself, this item will return a item that is a child of this items variant base. i.e. exact clone.
public varCopy ( ) : MetaModels\IItem
Результат MetaModels\IItem the new copy.

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

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

The data array containing the raw values obtained from the attributes.
protected array $arrData
Результат array

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

Get's populated with the first call to getMetaModel() (lazy initialization).
protected IMetaModel,metamodels $metaModel
Результат metamodels\IMetaModel