Documentation

Mage_Customer_Model_Resource_Attribute extends Mage_Eav_Model_Resource_Attribute
in package

Table of Contents

Properties

$_commitCallbacks  : array<string|int, mixed>
Array of callbacks subscribed to commit transaction commit
$_connections  : array<string|int, mixed>
Connections cache for this resource model
$_entityAttributes  : array<string|int, mixed>
Eav Entity attributes cache
$_idFieldName  : string
Main table primary key field name
$_isPkAutoIncrement  : bool
Primery key auto increment flag
$_mainTable  : string
Main table name
$_mainTableFields  : array<string|int, mixed>
Fields of main table
$_resourceModel  : string
Resource model name that contains entities (names of tables)
$_resourcePrefix  : string
Prefix for resources that will be used in this resource model
$_resources  : Mage_Core_Model_Resource
Cached resources singleton
$_serializableFields  : array<string|int, mixed>
Serializable fields declaration Structure: [ <field_name> => [ <default_value_for_serialization>, <default_for_unserialization>, <whether_to_unset_empty_when serializing> // optional parameter ], ]
$_tables  : array<string|int, mixed>
Tables used in this resource model
$_uniqueFields  : array<string|int, mixed>|null
Main table unique keys field names could [ ['field' => 'db_field_name1', 'title' => 'Field 1 should be unique'] ['field' => 'db_field_name2', 'title' => 'Field 2 should be unique'] [ 'field' => ['db_field_name3', 'db_field_name3'], 'title' => 'Field 3 and Field 4 combination should be unique' ] ] or string 'my_field_name' - will be autoconverted to [ [ 'field' => 'my_field_name', 'title' => 'my_field_name' ] ]
$_useIsObjectNew  : bool
Use is object new method for save of object

Methods

__construct()  : mixed
Main constructor
addCommitCallback()  : $this
Subscribe some callback to transaction commit
addUniqueField()  : $this
Add unique field restriction
afterLoad()  : mixed
After load
beginTransaction()  : $this
Start resource transaction
commit()  : $this
Commit resource transaction
delete()  : $this
Delete the object
deleteEntity()  : $this
Delete entity
describeTable()  : array<string|int, mixed>
Returns the column descriptions for a table
formatDate()  : string|null
Format date to internal format
getAdditionalAttributeTable()  : string
Retrieve additional attribute table name for specified entity type
getAttributeCodesByFrontendType()  : array<string|int, mixed>
Retrieve attribute codes by front-end type
getChecksum()  : array<string|int, mixed>|false
Retrieve table checksum
getIdByCode()  : string
Retrieve attribute id by entity type code and attribute code
getIdFieldName()  : string
Get primary key field name
getMainTable()  : string
Returns main table name - extracted from "module/table" style and validated by db adapter
getReadConnection()  : AdapterInterface
Temporary resolving collection compatibility
getScopeValues()  : array<string|int, mixed>
Return scope values for attribute and website
getStoreLabelsByAttributeId()  : array<string|int, mixed>
Retrieve store labels by given attribute id
getTable()  : string
Get table name for the entity, validated by db adapter
getUniqueFields()  : array<string|int, mixed>
Get configuration of all unique fields
getUsedInForms()  : array<string|int, mixed>
Return forms in which the attribute
getValidAttributeIds()  : array<string|int, mixed>
Load by given attributes ids and return only exist attribute ids
getValueTable()  : string
Retrieve table name for the entity separated value
getWebsiteValues()  : array<int, array{is_visible: ?int, is_required: ?int}>
Return the is_visible and is_required values of each website that has its own values.
hasConnection()  : bool
hasDataChanged()  : bool
Check that model data fields that can be saved has really changed comparing with origData
isModuleEnabled()  : bool
load()  : $this
Load an object
loadByCode()  : bool
Load attribute data by attribute code
mktime()  : int
Convert internal date to UNIX timestamp
resetUniqueField()  : $this
Reset unique fields restrictions
rollBack()  : $this
Roll back resource transaction
save()  : $this
Save object object data
saveInSetIncluding()  : $this
Save in set including
saveWebsiteValues()  : void
Save the mode of each website: '' uses the default values, and hidden, optional or required sets is_visible and is_required.
unserializeFields()  : mixed
Un-serialize serializable object fields
_afterDelete()  : $this
Perform actions after object delete
_afterLoad()  : $this
Load additional attribute data.
_afterSave()  : $this
Save attribute/form relations after attribute save
_beforeDelete()  : $this
Refuse to delete a system attribute. The stored row decides, so a change of the flag in memory does not count.
_beforeSave()  : $this
Validate attribute data before save
_canFieldHoldValue()  : bool
Return false when $field is an integer column of the main table and $value is out of its range. No row has such a value, and PostgreSQL refuses the query. The check uses the value as _getLoadSelect() converts it.
_checkUnique()  : $this
Check for unique values existence
_construct()  : mixed
_getConnection()  : AdapterInterface|false
Get connection by name or type
_getEavWebsiteTable()  : string|null
Get EAV website table
_getFormAttributeTable()  : string|null
Get Form attribute table
_getLoadSelect()  : Select
Retrieve select object for load object data
_getReadAdapter()  : AdapterInterface|false
Retrieve connection for read data
_getUniqueCheckValue()  : string|null
Return the value that the unique check compares with a column. A column that cannot hold the value stores its default, so the check uses the default. Return null when no row can hold the value.
_getWriteAdapter()  : AdapterInterface|false
Retrieve connection for write data
_init()  : mixed
Standard resource model initialization
_initUniqueFields()  : $this
Initialize unique fields
_loadTypeAttributes()  : $this
Load all entity type attributes
_prepareDataForSave()  : array<string|int, mixed>
Prepare data for save
_prepareDataForTable()  : array<string|int, mixed>
Prepare data for passed table
_prepareTableValueForSave()  : mixed
Prepare value for save
_prepareValueForSave()  : mixed
Prepare value for save
_saveAdditionalAttributeData()  : $this
Save additional data of attribute
_saveOption()  : $this
Save attribute options
_saveStoreLabels()  : $this
Save store labels
_serializeField()  : $this
Serialize specified field in an object
_serializeFields()  : mixed
Serialize serializable fields of the object
_setMainTable()  : $this
Set main entity table name and primary key field name If field name is omitted {table_name}_id will be used
_setResource()  : Mage_Core_Model_Resource_Abstract
Initialize connections and tables for this resource model If one or both arguments are string, will be used as prefix If $tables is null and $connections is string, $tables will be the same
_unserializeField()  : mixed
Unserialize \Maho\DataObject field in an object

Properties

$_commitCallbacks

Array of callbacks subscribed to commit transaction commit

protected static array<string|int, mixed> $_commitCallbacks = []

$_connections

Connections cache for this resource model

protected array<string|int, mixed> $_connections = []

$_entityAttributes

Eav Entity attributes cache

protected static array<string|int, mixed> $_entityAttributes = []

$_idFieldName

Main table primary key field name

protected string $_idFieldName

$_isPkAutoIncrement

Primery key auto increment flag

protected bool $_isPkAutoIncrement = \true

$_mainTable

Main table name

protected string $_mainTable

$_mainTableFields

Fields of main table

protected array<string|int, mixed> $_mainTableFields

$_resourceModel

Resource model name that contains entities (names of tables)

protected string $_resourceModel

$_resourcePrefix

Prefix for resources that will be used in this resource model

protected string $_resourcePrefix

$_serializableFields

Serializable fields declaration Structure: [ <field_name> => [ <default_value_for_serialization>, <default_for_unserialization>, <whether_to_unset_empty_when serializing> // optional parameter ], ]

protected array<string|int, mixed> $_serializableFields = []

$_tables

Tables used in this resource model

protected array<string|int, mixed> $_tables = []

$_uniqueFields

Main table unique keys field names could [ ['field' => 'db_field_name1', 'title' => 'Field 1 should be unique'] ['field' => 'db_field_name2', 'title' => 'Field 2 should be unique'] [ 'field' => ['db_field_name3', 'db_field_name3'], 'title' => 'Field 3 and Field 4 combination should be unique' ] ] or string 'my_field_name' - will be autoconverted to [ [ 'field' => 'my_field_name', 'title' => 'my_field_name' ] ]

protected array<string|int, mixed>|null $_uniqueFields = \null

$_useIsObjectNew

Use is object new method for save of object

protected bool $_useIsObjectNew = \false

Methods

__construct()

Main constructor

public __construct() : mixed

addCommitCallback()

Subscribe some callback to transaction commit

public addCommitCallback(callable $callback) : $this
Parameters
$callback : callable
Return values
$this

addUniqueField()

Add unique field restriction

public addUniqueField(array<string|int, mixed>|string $field) : $this
Parameters
$field : array<string|int, mixed>|string
Return values
$this

beginTransaction()

Start resource transaction

public beginTransaction() : $this
Return values
$this

commit()

Commit resource transaction

public commit() : $this
Return values
$this

describeTable()

Returns the column descriptions for a table

public describeTable(string $table) : array<string|int, mixed>
Parameters
$table : string
Return values
array<string|int, mixed>

formatDate()

Format date to internal format

public formatDate(int|string|DateTime|bool|null $date[, bool $withTime = true ]) : string|null

since 26.5 Use Mage::app()->getLocale()->formatDateForDb() instead

Parameters
$date : int|string|DateTime|bool|null
$withTime : bool = true
Tags
see
Mage_Core_Model_Locale::formatDateForDb()
Return values
string|null

getAdditionalAttributeTable()

Retrieve additional attribute table name for specified entity type

public getAdditionalAttributeTable(int $entityTypeId) : string
Parameters
$entityTypeId : int
Return values
string

getAttributeCodesByFrontendType()

Retrieve attribute codes by front-end type

public getAttributeCodesByFrontendType(string $frontendType) : array<string|int, mixed>
Parameters
$frontendType : string
Return values
array<string|int, mixed>

getChecksum()

Retrieve table checksum

public getChecksum(string|array<string|int, mixed> $table) : array<string|int, mixed>|false
Parameters
$table : string|array<string|int, mixed>
Return values
array<string|int, mixed>|false

getIdByCode()

Retrieve attribute id by entity type code and attribute code

public getIdByCode(string $entityType, string $code) : string
Parameters
$entityType : string
$code : string
Return values
string

getIdFieldName()

Get primary key field name

public getIdFieldName() : string
Return values
string

getMainTable()

Returns main table name - extracted from "module/table" style and validated by db adapter

public getMainTable() : string
Return values
string

getStoreLabelsByAttributeId()

Retrieve store labels by given attribute id

public getStoreLabelsByAttributeId(int $attributeId) : array<string|int, mixed>
Parameters
$attributeId : int
Return values
array<string|int, mixed>

getTable()

Get table name for the entity, validated by db adapter

public getTable(string|array<string|int, mixed> $entityName) : string
Parameters
$entityName : string|array<string|int, mixed>
Return values
string

getUniqueFields()

Get configuration of all unique fields

public getUniqueFields() : array<string|int, mixed>
Return values
array<string|int, mixed>

getValidAttributeIds()

Load by given attributes ids and return only exist attribute ids

public getValidAttributeIds(array<string|int, mixed> $attributeIds) : array<string|int, mixed>
Parameters
$attributeIds : array<string|int, mixed>
Return values
array<string|int, mixed>

getValueTable()

Retrieve table name for the entity separated value

public getValueTable(string $entityName, string $valueType) : string
Parameters
$entityName : string
$valueType : string
Return values
string

getWebsiteValues()

Return the is_visible and is_required values of each website that has its own values.

public getWebsiteValues(int $attributeId) : array<int, array{is_visible: ?int, is_required: ?int}>
Parameters
$attributeId : int
Return values
array<int, array{is_visible: ?int, is_required: ?int}>

hasConnection()

public hasConnection(string $connectionName) : bool
Parameters
$connectionName : string
Return values
bool

isModuleEnabled()

public isModuleEnabled(string $moduleName[, string $helperAlias = 'core' ]) : bool
Parameters
$moduleName : string
$helperAlias : string = 'core'
Return values
bool

mktime()

Convert internal date to UNIX timestamp

public mktime(string $str) : int
Parameters
$str : string
Return values
int

resetUniqueField()

Reset unique fields restrictions

public resetUniqueField() : $this
Return values
$this

rollBack()

Roll back resource transaction

public rollBack() : $this
Return values
$this

saveWebsiteValues()

Save the mode of each website: '' uses the default values, and hidden, optional or required sets is_visible and is_required.

public saveWebsiteValues(int $attributeId, array<int|string, string> $modes) : void
Parameters
$attributeId : int
$modes : array<int|string, string>

_canFieldHoldValue()

Return false when $field is an integer column of the main table and $value is out of its range. No row has such a value, and PostgreSQL refuses the query. The check uses the value as _getLoadSelect() converts it.

protected _canFieldHoldValue(string $field, mixed $value) : bool
Parameters
$field : string
$value : mixed
Return values
bool

_construct()

protected _construct() : mixed
Attributes
#[Override]

_getEavWebsiteTable()

Get EAV website table

protected _getEavWebsiteTable() : string|null

Get table, where website-dependent attribute parameters are stored If realization doesn't demand this functionality, let this function just return null

Attributes
#[Override]
Return values
string|null

_getFormAttributeTable()

Get Form attribute table

protected _getFormAttributeTable() : string|null

Get table, where dependency between form name and attribute ids is stored

Attributes
#[Override]
Return values
string|null

_getUniqueCheckValue()

Return the value that the unique check compares with a column. A column that cannot hold the value stores its default, so the check uses the default. Return null when no row can hold the value.

protected _getUniqueCheckValue(array<string, mixed> $column, mixed $value) : string|null
Parameters
$column : array<string, mixed>

the description of the column, from describeTable()

$value : mixed
Return values
string|null

_init()

Standard resource model initialization

protected _init(string $mainTable, string $idFieldName) : mixed
Parameters
$mainTable : string
$idFieldName : string

_initUniqueFields()

Initialize unique fields

protected _initUniqueFields() : $this
Attributes
#[Override]
Return values
$this

_loadTypeAttributes()

Load all entity type attributes

protected _loadTypeAttributes(int $entityTypeId) : $this
Parameters
$entityTypeId : int
Return values
$this

_prepareDataForTable()

Prepare data for passed table

protected _prepareDataForTable(DataObject $object, string $table) : array<string|int, mixed>
Parameters
$object : DataObject
$table : string
Return values
array<string|int, mixed>

_prepareTableValueForSave()

Prepare value for save

protected _prepareTableValueForSave(mixed $value, string $type) : mixed
Parameters
$value : mixed
$type : string

_prepareValueForSave()

Prepare value for save

protected _prepareValueForSave(mixed $value, string $type) : mixed
Parameters
$value : mixed
$type : string

_serializeField()

Serialize specified field in an object

protected _serializeField(DataObject $object, string $field[, mixed $defaultValue = null ][, bool $unsetEmpty = false ]) : $this
Parameters
$object : DataObject
$field : string
$defaultValue : mixed = null
$unsetEmpty : bool = false
Return values
$this

_setMainTable()

Set main entity table name and primary key field name If field name is omitted {table_name}_id will be used

protected _setMainTable(string $mainTable[, string|null $idFieldName = null ]) : $this
Parameters
$mainTable : string
$idFieldName : string|null = null
Return values
$this

_setResource()

Initialize connections and tables for this resource model If one or both arguments are string, will be used as prefix If $tables is null and $connections is string, $tables will be the same

protected _setResource(string|array<string|int, mixed> $connections[, string|array<string|int, mixed>|null $tables = null ]) : Mage_Core_Model_Resource_Abstract
Parameters
$connections : string|array<string|int, mixed>
$tables : string|array<string|int, mixed>|null = null
Return values
Mage_Core_Model_Resource_Abstract

_unserializeField()

Unserialize \Maho\DataObject field in an object

protected _unserializeField(DataObject $object, string $field[, mixed $defaultValue = null ]) : mixed
Parameters
$object : DataObject
$field : string
$defaultValue : mixed = null
On this page

Search results