Documentation

Mage_Eav_Model_Entity_Abstract extends Mage_Core_Model_Resource_Abstract
in package
implements Mage_Eav_Model_Entity_Interface

AbstractYes

Table of Contents

Interfaces

Mage_Eav_Model_Entity_Interface

Properties

$_attributeBackendTables  : array<string|int, mixed>
Array of describe attribute backend tables The table name as key
$_attributesByCode  : array<string|int, mixed>
Attributes array by attribute name
$_attributesById  : array<string|int, mixed>
Attributes array by attribute id
$_attributesByTable  : array<string|int, mixed>
2-dimensional array by table name and attribute name
$_attributeValuesToDelete  : array<string|int, mixed>
Entity attribute values per backend table to delete
$_attributeValuesToSave  : array<string|int, mixed>
Entity attribute values per backend table to save
$_commitCallbacks  : array<string|int, mixed>
Array of callbacks subscribed to commit transaction commit
$_defaultAttributes  : array<string|int, mixed>
Default Attributes that are static
$_describeTable  : array<string|int, mixed>
Describe data for tables
$_entityIdField  : string
Entity table identification field name
$_entityTable  : string
Entity table
$_entityTablePrefix  : mixed
$_isPartialLoad  : bool
Partial load flag
$_isPartialSave  : bool
Partial save flag
$_read  : string|AdapterInterface
Read connection
$_sortingSetId  : int
Attribute set id which used for get sorted attributes
$_staticAttributes  : array<string|int, mixed>
Attributes that are static fields in entity table
$_type  : Mage_Eav_Model_Entity_Type|null
Entity type configuration
$_valueEntityIdField  : string
Entity values table identification field name
$_valueTablePrefix  : string
Entity value table prefix
$_write  : string|AdapterInterface
Write connection

Methods

__construct()  : mixed
Main constructor
addAttribute()  : $this
Adding attribute to entity
addCommitCallback()  : $this
Subscribe some callback to transaction commit
attributesCompare()  : int
Compare attributes
beginTransaction()  : $this
Start resource transaction
checkAttributeUniqueValue()  : bool
Check attribute unique value
commit()  : $this
Commit resource transaction
delete()  : $this
Delete entity using current object's data
formatDate()  : string|null
Format date to internal format
getAttribute()  : Mage_Eav_Model_Entity_Attribute_Abstract|Mage_Catalog_Model_Resource_Eav_Attribute|false
Retrieve attribute instance by name, id or config node
getAttributesByCode()  : array<string|int, mixed>
Get attributes by name array
getAttributesById()  : array<string|int, mixed>
Get attributes by id array
getAttributesByTable()  : array<string|int, mixed>
Get attributes by table and name array
getDefaultAttributes()  : array<string|int, mixed>
Retrieve default entity static attributes
getDefaultAttributeSourceModel()  : string
Retrieve default source model
getEntityIdField()  : string
Get entity id field name in entity table
getEntityTable()  : string
Get entity table name
getEntityTablePrefix()  : string
Get entity table prefix for value
getEntityType()  : Mage_Eav_Model_Entity_Type
Retrieve current entity config
getIdFieldName()  : string
For compatibility with Mage_Core_Model_Abstract
getReadConnection()  : AdapterInterface|false
Retrieve read DB connection
getSortedAttributes()  : array<string|int, mixed>
Retrieve sorted attributes
getTable()  : string
Retrieve table name
getType()  : string
Get entity type name
getTypeId()  : int
Get entity type id
getValueEntityIdField()  : string
Get default entity id field name in attribute values tables
getValueTablePrefix()  : string
Get prefix for value tables
getWriteConnection()  : AdapterInterface
Retrieve write DB connection
isAttributeStatic()  : bool
Check whether the attribute is a real field in entity table
isModuleEnabled()  : bool
isPartialLoad()  : bool
Retrieve partial load flag
isPartialSave()  : bool
Retrieve partial save flag
load()  : $this
Load entity's attributes into the object
loadAllAttributes()  : $this
Retrieve configuration for all attributes
mktime()  : int
Convert internal date to UNIX timestamp
rollBack()  : $this
Roll back resource transaction
save()  : $this
Save entity's attributes into the object's resource
saveAttribute()  : self
setConnection()  : $this
Set connections for entity operations
setNewIncrementId()  : $this
Set new increment id to object
setType()  : $this
Set configuration for the entity
unsetAttributes()  : $this
Unset attributes
validate()  : true|array<string|int, mixed>
Validate all object's attributes against configuration
walkAttributes()  : array<string|int, mixed>
Walk through the attributes and run method with optional arguments
_addLoadAttributesSelectFields()  : Select
Adds Columns prepared for union
_afterDelete()  : $this
After delete entity process
_afterLoad()  : $this
After Load Entity process
_afterSave()  : $this
After Save Entity process
_beforeDelete()  : $this
Before Delete Entity process
_beforeSave()  : $this
Before delete Entity process
_canEntityIdExist()  : bool
Return false when the ID column of the entity table cannot hold $entityId: an empty value, a text that is not a whole number, or a number out of the range of the column. No row has such an ID, and PostgreSQL refuses the query.
_canUpdateAttribute()  : bool
Return if attribute exists in original data array.
_collectSaveData()  : array<string|int, mixed>
Prepare entity object data for save
_construct()  : mixed
_deleteAttributes()  : $this
Delete entity attribute values
_getDefaultAttribute()  : Mage_Eav_Model_Entity_Attribute
Return default static virtual attribute that doesn't exists in EAV attributes
_getDefaultAttributeModel()  : string
Retrieve Default attribute model
_getDefaultAttributes()  : array<string|int, mixed>
Retrieve default entity attributes
_getLoadAttributesSelect()  : Select
Retrieve select object for loading entity attributes values
_getLoadRowSelect()  : Select
Retrieve select object for loading base entity row
_getOrigObject()  : DataObject
Retrieve Object instance with original data
_getReadAdapter()  : AdapterInterface|false
Retrieve connection for read data
_getStaticFieldProperties()  : array<string|int, mixed>|false
Retrieve static field properties
_getWriteAdapter()  : AdapterInterface|false
Retrieve connection for write data
_insertAttribute()  : $this
Insert entity attribute value
_isApplicableAttribute()  : bool
Check whether the attribute is Applicable to the object
_isAttributeValueEmpty()  : bool
Check is attribute value empty
_isCallableAttributeInstance()  : bool
Check whether attribute instance (attribute, backend, frontend or source) has method and applicable
_loadModelAttributes()  : $this
Load model attributes data
_prepareDataForTable()  : array<string|int, mixed>
Prepare data for passed table
_prepareLoadSelect()  : Select
Prepare select object for loading entity attributes values
_prepareStaticValue()  : mixed
Prepare static value for save
_prepareTableValueForSave()  : mixed
Prepare value for save
_prepareValueForSave()  : mixed
Prepare value for save
_processAttributeValues()  : $this
Save and detele collected attribute values
_processSaveData()  : $this
Save object collected data
_saveAttribute()  : $this
Save entity attribute value
_serializeField()  : $this
Serialize specified field in an object
_setAttributeValue()  : $this
Initialize attribute value for object
_unserializeField()  : mixed
Unserialize \Maho\DataObject field in an object
_updateAttribute()  : $this
Update entity attribute value
saveStaticAttribute()  : self
Save static attribute to main entity table

Properties

$_attributeBackendTables

Array of describe attribute backend tables The table name as key

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

$_attributesByCode

Attributes array by attribute name

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

$_attributesById

Attributes array by attribute id

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

$_attributesByTable

2-dimensional array by table name and attribute name

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

$_attributeValuesToDelete

Entity attribute values per backend table to delete

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

$_attributeValuesToSave

Entity attribute values per backend table to save

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

$_commitCallbacks

Array of callbacks subscribed to commit transaction commit

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

$_defaultAttributes

Default Attributes that are static

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

$_describeTable

Describe data for tables

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

$_entityIdField

Entity table identification field name

protected string $_entityIdField

$_entityTable

Entity table

protected string $_entityTable

$_entityTablePrefix

protected mixed $_entityTablePrefix

$_isPartialLoad

Partial load flag

protected bool $_isPartialLoad = \false

$_isPartialSave

Partial save flag

protected bool $_isPartialSave = \false

$_sortingSetId

Attribute set id which used for get sorted attributes

protected int $_sortingSetId = \null

$_staticAttributes

Attributes that are static fields in entity table

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

$_valueEntityIdField

Entity values table identification field name

protected string $_valueEntityIdField

$_valueTablePrefix

Entity value table prefix

protected string $_valueTablePrefix

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

beginTransaction()

Start resource transaction

public beginTransaction() : $this
Return values
$this

commit()

Commit resource transaction

public commit() : $this
Return values
$this

delete()

Delete entity using current object's data

public delete(int|string|DataObject $object) : $this
Parameters
$object : int|string|DataObject
Tags
throws
Exception
Return values
$this

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

getAttribute()

Retrieve attribute instance by name, id or config node

public getAttribute(string|int|Mage_Core_Model_Config_Element $attribute) : Mage_Eav_Model_Entity_Attribute_Abstract|Mage_Catalog_Model_Resource_Eav_Attribute|false

This will add the attribute configuration to entity's attributes cache

If attribute is not found false is returned

Parameters
$attribute : string|int|Mage_Core_Model_Config_Element
Return values
Mage_Eav_Model_Entity_Attribute_Abstract|Mage_Catalog_Model_Resource_Eav_Attribute|false

getAttributesByCode()

Get attributes by name array

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

getAttributesById()

Get attributes by id array

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

getAttributesByTable()

Get attributes by table and name array

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

getDefaultAttributes()

Retrieve default entity static attributes

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

getDefaultAttributeSourceModel()

Retrieve default source model

public getDefaultAttributeSourceModel() : string
Return values
string

getEntityIdField()

Get entity id field name in entity table

public getEntityIdField() : string
Return values
string

getEntityTable()

Get entity table name

public getEntityTable() : string
Return values
string

getEntityTablePrefix()

Get entity table prefix for value

public getEntityTablePrefix() : string
Return values
string

getIdFieldName()

For compatibility with Mage_Core_Model_Abstract

public getIdFieldName() : string
Return values
string

getSortedAttributes()

Retrieve sorted attributes

public getSortedAttributes([int $setId = null ]) : array<string|int, mixed>
Parameters
$setId : int = null
Return values
array<string|int, mixed>

getTable()

Retrieve table name

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

getType()

Get entity type name

public getType() : string
Return values
string

getTypeId()

Get entity type id

public getTypeId() : int
Return values
int

getValueEntityIdField()

Get default entity id field name in attribute values tables

public getValueEntityIdField() : string
Return values
string

getValueTablePrefix()

Get prefix for value tables

public getValueTablePrefix() : string
Return values
string

isModuleEnabled()

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

isPartialLoad()

Retrieve partial load flag

public isPartialLoad([bool $flag = null ]) : bool
Parameters
$flag : bool = null
Return values
bool

isPartialSave()

Retrieve partial save flag

public isPartialSave([bool $flag = null ]) : bool
Parameters
$flag : bool = null
Return values
bool

load()

Load entity's attributes into the object

public load(Mage_Core_Model_Abstract $object, int $entityId[, array<string|int, mixed>|null $attributes = [] ]) : $this
Parameters
$object : Mage_Core_Model_Abstract
$entityId : int
$attributes : array<string|int, mixed>|null = []
Return values
$this

loadAllAttributes()

Retrieve configuration for all attributes

public loadAllAttributes([object $object = null ]) : $this
Parameters
$object : object = null
Tags
throws
Mage_Core_Exception
Return values
$this

mktime()

Convert internal date to UNIX timestamp

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

rollBack()

Roll back resource transaction

public rollBack() : $this
Return values
$this

save()

Save entity's attributes into the object's resource

public save(DataObject $object) : $this
Parameters
$object : DataObject
Return values
$this

saveAttribute()

public saveAttribute(DataObject $object, string $attributeCode) : self
Parameters
$object : DataObject
$attributeCode : string
Return values
self

setNewIncrementId()

Set new increment id to object

public setNewIncrementId(DataObject $object) : $this
Parameters
$object : DataObject
Return values
$this

unsetAttributes()

Unset attributes

public unsetAttributes([array<string|int, mixed>|string|null $attributes = null ]) : $this

If NULL or not supplied removes configuration of all attributes If string - removes only one, if array - all specified

Parameters
$attributes : array<string|int, mixed>|string|null = null
Return values
$this

walkAttributes()

Walk through the attributes and run method with optional arguments

public walkAttributes(string $partMethod[, array<string|int, mixed> $args = [] ]) : array<string|int, mixed>

Returns array with results for each attribute

if $method is in format "part/method" will run method on specified part for example: $this->walkAttributes('backend/validate');

Parameters
$partMethod : string
$args : array<string|int, mixed> = []
Tags
throws
Mage_Eav_Model_Entity_Attribute_Exception
Return values
array<string|int, mixed>

_addLoadAttributesSelectFields()

Adds Columns prepared for union

protected _addLoadAttributesSelectFields(Select $select, string $table, string $type) : Select
Parameters
$select : Select
$table : string
$type : string
Return values
Select

_afterDelete()

After delete entity process

protected _afterDelete(DataObject $object) : $this
Parameters
$object : DataObject
Return values
$this

_afterLoad()

After Load Entity process

protected _afterLoad(DataObject $object) : $this
Parameters
$object : DataObject
Return values
$this

_afterSave()

After Save Entity process

protected _afterSave(DataObject $object) : $this
Parameters
$object : DataObject
Return values
$this

_beforeDelete()

Before Delete Entity process

protected _beforeDelete(DataObject $object) : $this
Parameters
$object : DataObject
Return values
$this

_beforeSave()

Before delete Entity process

protected _beforeSave(DataObject $object) : $this
Parameters
$object : DataObject
Return values
$this

_canEntityIdExist()

Return false when the ID column of the entity table cannot hold $entityId: an empty value, a text that is not a whole number, or a number out of the range of the column. No row has such an ID, and PostgreSQL refuses the query.

protected _canEntityIdExist(mixed $entityId) : bool
Parameters
$entityId : mixed
Return values
bool

_collectSaveData()

Prepare entity object data for save

protected _collectSaveData(DataObject $newObject) : array<string|int, mixed>

result array structure: array ( 'newObject', 'entityRow', 'insert', 'update', 'delete' )

Parameters
$newObject : DataObject
Return values
array<string|int, mixed>

_construct()

protected _construct() : mixed
Attributes
#[Override]

_deleteAttributes()

Delete entity attribute values

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

_getDefaultAttributeModel()

Retrieve Default attribute model

protected _getDefaultAttributeModel() : string
Return values
string

_getDefaultAttributes()

Retrieve default entity attributes

protected _getDefaultAttributes() : array<string|int, mixed>
Return values
array<string|int, mixed>

_getLoadAttributesSelect()

Retrieve select object for loading entity attributes values

protected _getLoadAttributesSelect(DataObject $object, string $table) : Select
Parameters
$object : DataObject
$table : string
Return values
Select

_getLoadRowSelect()

Retrieve select object for loading base entity row

protected _getLoadRowSelect(DataObject $object, mixed $rowId) : Select
Parameters
$object : DataObject
$rowId : mixed
Return values
Select

_getStaticFieldProperties()

Retrieve static field properties

protected _getStaticFieldProperties(string $field) : array<string|int, mixed>|false
Parameters
$field : string
Return values
array<string|int, mixed>|false

_isCallableAttributeInstance()

Check whether attribute instance (attribute, backend, frontend or source) has method and applicable

protected _isCallableAttributeInstance(Mage_Eav_Model_Entity_Attribute_Abstract|Mage_Eav_Model_Entity_Attribute_Backend_Abstract|Mage_Eav_Model_Entity_Attribute_Frontend_Abstract|Mage_Eav_Model_Entity_Attribute_Source_Abstract $instance, string $method, array<string|int, mixed> $args) : bool
Parameters
$instance : Mage_Eav_Model_Entity_Attribute_Abstract|Mage_Eav_Model_Entity_Attribute_Backend_Abstract|Mage_Eav_Model_Entity_Attribute_Frontend_Abstract|Mage_Eav_Model_Entity_Attribute_Source_Abstract
$method : string
$args : array<string|int, mixed>

array of arguments

Return values
bool

_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>

_prepareLoadSelect()

Prepare select object for loading entity attributes values

protected _prepareLoadSelect(array<string|int, mixed> $selects) : Select
Parameters
$selects : array<string|int, mixed>
Return values
Select

_prepareStaticValue()

Prepare static value for save

protected _prepareStaticValue(string $key, mixed $value) : mixed
Parameters
$key : string
$value : mixed

_prepareTableValueForSave()

Prepare value for save

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

_processAttributeValues()

Save and detele collected attribute values

protected _processAttributeValues() : $this
Return values
$this

_processSaveData()

Save object collected data

protected _processSaveData(array<string|int, mixed> $saveData) : $this
Parameters
$saveData : array<string|int, mixed>

['newObject', 'entityRow', 'insert', 'update', 'delete']

Return values
$this

_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

_setAttributeValue()

Initialize attribute value for object

protected _setAttributeValue(DataObject $object, array<string|int, mixed> $valueRow) : $this
Parameters
$object : DataObject
$valueRow : array<string|int, mixed>
Return values
$this

_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