Mage_Catalog_Model_Product_Option
extends Mage_Core_Model_Abstract
in package
Catalog product option model
Table of Contents
Constants
- OPTION_GROUP_DATE : mixed = 'date'
- Option group date
- OPTION_GROUP_FILE : mixed = 'file'
- Option group file
- OPTION_GROUP_SELECT : mixed = 'select'
- Option group select
- OPTION_GROUP_TEXT : mixed = 'text'
- Option group text
- OPTION_TYPE_AREA : mixed = 'area'
- Option type area
- OPTION_TYPE_CHECKBOX : mixed = 'checkbox'
- Option type checkbox
- OPTION_TYPE_DATE : mixed = 'date'
- Option type date
- OPTION_TYPE_DATE_TIME : mixed = 'date_time'
- Option type date/time
- OPTION_TYPE_DROP_DOWN : mixed = 'drop_down'
- Option type drop down
- OPTION_TYPE_FIELD : mixed = 'field'
- Option type field
- OPTION_TYPE_FILE : mixed = 'file'
- Option group file
- OPTION_TYPE_MULTIPLE : mixed = 'multiple'
- Option type multiple
- OPTION_TYPE_RADIO : mixed = 'radio'
- Option type radio
- OPTION_TYPE_TIME : mixed = 'time'
- Option type time
Properties
- $_cacheTag : string|bool|array<string|int, mixed>
- Model cache tag for clear cache in after save and after delete
- $_data : array<string|int, mixed>|null
- Object attributes
- $_dataSaveAllowed : bool
- Flag which can stop data saving after before save Can be used for next sequence: we check data in _beforeSave, if data are not valid - we can set this flag to false value and save process will be stopped
- $_dirty : array<string|int, mixed>
- $_eventObject : string
- Parameter name in event
- $_eventPrefix : string
- Prefix of model events names
- $_hasDataChanges : bool
- Data changes flag (true after setData|unsetData call)
- $_idFieldName : string
- Name of object id field
- $_isDeleted : bool
- Object delete flag
- $_isObjectNew : bool|null
- Flag which allow detect object state: is it new object (without id) or existing one (with id)
- $_oldFieldsMap : array<string|int, mixed>
- Map short fields names to its full names
- $_options : array<string|int, mixed>
- Options
- $_origData : array<string|int, mixed>|null
- Original data that was loaded
- $_product : Mage_Catalog_Model_Product
- Product instance
- $_resource : Mage_Core_Model_Resource_Db_Abstract
- Resource model instance
- $_resourceCollectionName : string
- Name of the resource collection model
- $_resourceName : string
- Name of the resource model
- $_syncFieldsMap : mixed
- Map of fields to sync to other fields upon changing their data
- $_underscoreCache : array<string|int, mixed>
- Setter/Getter underscore transformation cache
- $_valueInstance : Mage_Catalog_Model_Product_Option_Value
- Value instance
- $_values : array<string|int, mixed>
- Values
Methods
- __call() : mixed
- Set/Get attribute wrapper
- __construct() : mixed
- Constructor
- __get() : mixed
- Attribute getter (deprecated)
- __set() : mixed
- Attribute setter (deprecated)
- __toArray() : array<string|int, mixed>
- Convert object attributes to array
- _getResource() : Mage_Catalog_Model_Resource_Product_Option
- Get resource instance
- addData() : $this
- Add data to the object.
- addOption() : $this
- Add option for save it
- addValue() : $this
- Add value of option to values array
- afterCommitCallback() : $this
- Callback function which called after transaction commit in resource model
- afterLoad() : $this
- Object after load processing. Implemented as public interface for supporting objects after load in collections
- cleanModelCache() : $this
- Remove model object related cache
- clearInstance() : $this
- Clearing object for correct deleting by garbage collector
- dataHasChangedFor() : bool
- Compare object data with original data
- debug() : string|array<string|int, mixed>
- Present object data as string in debug mode
- delete() : $this
- Delete object from database
- deletePrices() : $this
- Delete prices of option
- deleteTitles() : $this
- Delete titles of option
- duplicate() : $this
- Duplicate options for product
- flagDirty() : $this
- getAddRequiredFilter() : bool|null
- getAddRequiredFilterValue() : bool|null
- getBillingAddress() : Mage_Customer_Model_Address_Abstract|null
- getCacheIdTags() : array<string|int, mixed>|false
- Get cache tags associated with object id
- getCacheTags() : array<string|int, mixed>|false
- Get list of cache tags applied to model object.
- getCollection() : Mage_Catalog_Model_Resource_Product_Option_Collection
- getCreatedAt() : string|null
- getData() : mixed
- Object data getter
- getDataByKey() : mixed
- Get object data by particular key
- getDataByPath() : mixed
- Get object data by path
- getDataSetDefault() : mixed
- Fast get data or set default if value is not available
- getDataUsingMethod() : mixed
- Get object data by key with calling getter method
- getEntityId() : int
- getFileExtension() : string|null
- getGroupByType() : string
- Get group name of option by given option type
- getId() : int|string|null
- Retrieve model object identifier
- getIdFieldName() : string
- Retrieve identifier field name for model
- getImageSizeX() : int|null
- getImageSizeY() : int|null
- getIsRequire() : bool|null
- getIsRequired() : int
- Check if value is required
- getMaxCharacters() : int|null
- getOptionId() : int|null
- getOptions() : array<string|int, mixed>
- Get all options
- getOptionValuesByOptionId() : Mage_Catalog_Model_Resource_Product_Option_Value_Collection
- Get collection of values by given option ids
- getOrigData() : mixed
- Get object loaded data (original data)
- getPrice() : float
- Return price. If $flag is true and price is percent return converted percent to price
- getPriceType() : string|null
- getProduct() : Mage_Catalog_Model_Product
- Retrieve product instance
- getProductId() : int|string|null
- getProductOptionCollection() : Mage_Catalog_Model_Resource_Product_Option_Collection
- get Product Option Collection
- getResource() : Mage_Catalog_Model_Resource_Product_Option
- Retrieve model resource
- getResourceCollection() : Mage_Core_Model_Resource_Db_Collection_Abstract
- Get collection instance
- getResourceName() : string
- Retrieve model resource name
- getSearchableData() : array<string|int, mixed>
- Retrieve option searchable data
- getShippingAddress() : Mage_Customer_Model_Address_Abstract|null
- getSku() : string|null
- getSortOrder() : int|null
- getStoreId() : int|null
- getStorePrice() : float|null
- getStoreTitle() : string|null
- getTitle() : string|null
- getType() : string|null
- getValueById() : Mage_Catalog_Model_Product_Option_Value
- Get value by given id
- getValueInstance() : Mage_Catalog_Model_Product_Option_Value
- Retrieve value instance
- getValues() : array<string|int, Mage_Catalog_Model_Product_Option_Value>
- Get values
- getValuesCollection() : Mage_Catalog_Model_Resource_Product_Option_Value_Collection
- Get collection of values for current option
- groupFactory() : Mage_Catalog_Model_Product_Option_Type_Default
- Group model factory
- hasData() : bool
- If $key is empty, checks whether there's any data in the object Otherwise checks if the specified attribute is set.
- hasDataChanges() : bool
- Get data change status
- hasErrors() : bool
- isDeleted() : bool
- Set _isDeleted flag value (if $isDeleted param is defined) and return current flag value
- isDirty() : bool
- isEmpty() : bool
- checks whether the object is empty
- isModuleEnabled() : bool
- isMultipleType() : bool
- Check whether custom option could have multiple values
- isObjectNew() : bool
- Check object state (true - if it is object without id on object just created) This method can help detect if object just created in _afterSave method problem is what in after save object has id and we can't detect what object was created in this transaction
- jsonSerialize() : array<string|int, mixed>
- Implementation of JsonSerializable::jsonSerialize()
- load() : $this
- Load object data
- offsetExists() : bool
- Implementation of ArrayAccess::offsetExists()
- offsetGet() : mixed
- Implementation of ArrayAccess::offsetGet()
- offsetSet() : void
- Implementation of ArrayAccess::offsetSet()
- offsetUnset() : void
- Implementation of ArrayAccess::offsetUnset()
- prepareOptionForDuplicate() : array<string|int, mixed>
- Prepare array of options for duplicate
- save() : $this
- Save object data
- saveOptions() : $this
- Save options.
- serialize() : string
- serialize object attributes
- setAttribute() : $this
- setCreatedAt() : static
- setData() : $this
- Overwrite data in the object.
- setDataChanges() : $this
- Clears data changes status
- setDataUsingMethod() : $this
- Set object data with calling setter method
- setFileExtension() : static
- setId() : $this
- Declare model object identifier value
- setIdFieldName() : $this
- set name of object id field
- setImageSizeX() : static
- setImageSizeY() : static
- setIsRequire() : static
- setIsRequired() : self
- Set value required
- setMaxCharacters() : static
- setOptionId() : static
- setOptions() : $this
- Set options for array
- setOrigData() : $this
- Initialize object original data
- setProduct() : $this
- Set product instance
- setProductId() : static
- setSku() : static
- setSortOrder() : static
- setType() : static
- setUpdatedAt() : static
- toArray() : array<string|int, mixed>
- Public wrapper for __toArray
- toJson() : string
- Public wrapper for __toJson
- toString() : string
- Public wrapper for __toString
- toXml() : string
- Public wrapper for __toXml
- unsetData() : $this
- Unset data from the object.
- unsetOldData() : $this
- Unset old fields data from the object.
- unsetOptions() : $this
- Set options to empty array
- __toJson() : string
- Convert object attributes to JSON
- __toXml() : string
- Convert object attributes to XML
- _addFullNames() : mixed
- _afterDelete() : $this
- Processing object after delete data
- _afterDeleteCommit() : $this
- Processing manipulation after main transaction commit
- _afterLoad() : $this
- Processing object after load data
- _afterSave() : Mage_Core_Model_Abstract
- After save
- _beforeDelete() : $this
- Processing object before delete data
- _beforeLoad() : $this
- Processing object before load data
- _beforeSave() : $this
- Processing object before save data
- _camelize() : string
- _clearData() : $this
- Clearing object's data
- _clearReferences() : $this
- Clearing cyclic references
- _construct() : void
- Internal constructor not depended on params. Can be used for object initialization
- _getData() : mixed
- Get value from _data array without parse key
- _getEventData() : array<string|int, mixed>
- Get array of objects transferred to default events processing
- _hasModelChanged() : bool
- Check whether model has changed data.
- _init() : mixed
- Standard model initialization
- _initOldFieldsMap() : mixed
- Inits mapping array of object's previously used fields to new fields.
- _prepareArray() : array<string|int, mixed>
- Set required array elements
- _prepareSyncFieldsMap() : $this
- Called after old fields are inited. Forms synchronization map to sync old fields and new fields between each other.
- _protectFromNonAdmin() : mixed
- Safeguard func that will check, if we are in admin area
- _setResourceModel() : mixed
- Set resource names
- _underscore() : string
- Converts field names for setters and getters
- validateFileExtensions() : self
- Validate file extensions against forbidden list
Constants
OPTION_GROUP_DATE
Option group date
public
mixed
OPTION_GROUP_DATE
= 'date'
OPTION_GROUP_FILE
Option group file
public
mixed
OPTION_GROUP_FILE
= 'file'
OPTION_GROUP_SELECT
Option group select
public
mixed
OPTION_GROUP_SELECT
= 'select'
OPTION_GROUP_TEXT
Option group text
public
mixed
OPTION_GROUP_TEXT
= 'text'
OPTION_TYPE_AREA
Option type area
public
mixed
OPTION_TYPE_AREA
= 'area'
OPTION_TYPE_CHECKBOX
Option type checkbox
public
mixed
OPTION_TYPE_CHECKBOX
= 'checkbox'
OPTION_TYPE_DATE
Option type date
public
mixed
OPTION_TYPE_DATE
= 'date'
OPTION_TYPE_DATE_TIME
Option type date/time
public
mixed
OPTION_TYPE_DATE_TIME
= 'date_time'
OPTION_TYPE_DROP_DOWN
Option type drop down
public
mixed
OPTION_TYPE_DROP_DOWN
= 'drop_down'
OPTION_TYPE_FIELD
Option type field
public
mixed
OPTION_TYPE_FIELD
= 'field'
OPTION_TYPE_FILE
Option group file
public
mixed
OPTION_TYPE_FILE
= 'file'
OPTION_TYPE_MULTIPLE
Option type multiple
public
mixed
OPTION_TYPE_MULTIPLE
= 'multiple'
OPTION_TYPE_RADIO
Option type radio
public
mixed
OPTION_TYPE_RADIO
= 'radio'
OPTION_TYPE_TIME
Option type time
public
mixed
OPTION_TYPE_TIME
= 'time'
Properties
$_cacheTag
Model cache tag for clear cache in after save and after delete
protected
string|bool|array<string|int, mixed>
$_cacheTag
= \false
When you use true - all cache will be clean
$_data
Object attributes
protected
array<string|int, mixed>|null
$_data
= []
$_dataSaveAllowed
Flag which can stop data saving after before save Can be used for next sequence: we check data in _beforeSave, if data are not valid - we can set this flag to false value and save process will be stopped
protected
bool
$_dataSaveAllowed
= \true
$_dirty
protected
array<string|int, mixed>
$_dirty
$_eventObject
Parameter name in event
protected
string
$_eventObject
= 'object'
In observe method you can use $observer->getEvent()->getObject() in this case
$_eventPrefix
Prefix of model events names
protected
string
$_eventPrefix
= 'core_abstract'
$_hasDataChanges
Data changes flag (true after setData|unsetData call)
protected
bool
$_hasDataChanges
= false
$_idFieldName
Name of object id field
protected
string
$_idFieldName
= null
$_isDeleted
Object delete flag
protected
bool
$_isDeleted
= false
$_isObjectNew
Flag which allow detect object state: is it new object (without id) or existing one (with id)
protected
bool|null
$_isObjectNew
= \null
$_oldFieldsMap
Map short fields names to its full names
protected
array<string|int, mixed>
$_oldFieldsMap
= []
$_options
Options
protected
array<string|int, mixed>
$_options
= []
$_origData
Original data that was loaded
protected
array<string|int, mixed>|null
$_origData
$_product
Product instance
protected
Mage_Catalog_Model_Product
$_product
$_resource
Resource model instance
protected
Mage_Core_Model_Resource_Db_Abstract
$_resource
$_resourceCollectionName
Name of the resource collection model
protected
string
$_resourceCollectionName
$_resourceName
Name of the resource model
protected
string
$_resourceName
$_syncFieldsMap
Map of fields to sync to other fields upon changing their data
protected
mixed
$_syncFieldsMap
= []
$_underscoreCache
Setter/Getter underscore transformation cache
protected
static array<string|int, mixed>
$_underscoreCache
= []
$_valueInstance
Value instance
protected
Mage_Catalog_Model_Product_Option_Value
$_valueInstance
$_values
Values
protected
array<string|int, mixed>
$_values
= []
Methods
__call()
Set/Get attribute wrapper
public
__call(string $method, array<string|int, mixed> $args) : mixed
Parameters
- $method : string
- $args : array<string|int, mixed>
__construct()
Constructor
public
__construct() : mixed
By default, is looking for first argument as array and assigns it as object attributes This behaviour may change in child classes
__get()
Attribute getter (deprecated)
public
__get(string $var) : mixed
Parameters
- $var : string
__set()
Attribute setter (deprecated)
public
__set(string $var, mixed $value) : mixed
Parameters
- $var : string
- $value : mixed
__toArray()
Convert object attributes to array
public
__toArray([array<string|int, mixed> $arrAttributes = [] ]) : array<string|int, mixed>
Parameters
- $arrAttributes : array<string|int, mixed> = []
-
array of required attributes
Return values
array<string|int, mixed>_getResource()
Get resource instance
public
_getResource() : Mage_Catalog_Model_Resource_Product_Option
Return values
Mage_Catalog_Model_Resource_Product_OptionaddData()
Add data to the object.
public
addData(array<string|int, mixed> $arr) : $this
Retains previous data in the object.
Parameters
- $arr : array<string|int, mixed>
Return values
$thisaddOption()
Add option for save it
public
addOption(array<string|int, mixed> $option) : $this
Parameters
- $option : array<string|int, mixed>
Return values
$thisaddValue()
Add value of option to values array
public
addValue(Mage_Catalog_Model_Product_Option_Value $value) : $this
Parameters
Return values
$thisafterCommitCallback()
Callback function which called after transaction commit in resource model
public
afterCommitCallback() : $this
Return values
$thisafterLoad()
Object after load processing. Implemented as public interface for supporting objects after load in collections
public
afterLoad() : $this
Return values
$thiscleanModelCache()
Remove model object related cache
public
cleanModelCache() : $this
Return values
$thisclearInstance()
Clearing object for correct deleting by garbage collector
public
final clearInstance() : $this
Return values
$thisdataHasChangedFor()
Compare object data with original data
public
dataHasChangedFor(string $field) : bool
Parameters
- $field : string
Return values
booldebug()
Present object data as string in debug mode
public
debug([mixed $data = null ][, array<string|int, mixed> &$objects = [] ]) : string|array<string|int, mixed>
Parameters
- $data : mixed = null
- $objects : array<string|int, mixed> = []
Return values
string|array<string|int, mixed>delete()
Delete object from database
public
delete() : $this
Tags
Return values
$thisdeletePrices()
Delete prices of option
public
deletePrices(int|string $optionId) : $this
Parameters
- $optionId : int|string
Return values
$thisdeleteTitles()
Delete titles of option
public
deleteTitles(int|string $optionId) : $this
Parameters
- $optionId : int|string
Return values
$thisduplicate()
Duplicate options for product
public
duplicate(int $oldProductId, int $newProductId) : $this
Parameters
- $oldProductId : int
- $newProductId : int
Return values
$thisflagDirty()
public
flagDirty(string $field[, bool $flag = true ]) : $this
Parameters
- $field : string
- $flag : bool = true
Return values
$thisgetAddRequiredFilter()
public
getAddRequiredFilter() : bool|null
Return values
bool|nullgetAddRequiredFilterValue()
public
getAddRequiredFilterValue() : bool|null
Return values
bool|nullgetBillingAddress()
public
getBillingAddress() : Mage_Customer_Model_Address_Abstract|null
Return values
Mage_Customer_Model_Address_Abstract|nullgetCacheIdTags()
Get cache tags associated with object id
public
getCacheIdTags() : array<string|int, mixed>|false
Return values
array<string|int, mixed>|falsegetCacheTags()
Get list of cache tags applied to model object.
public
getCacheTags() : array<string|int, mixed>|false
Return false if cache tags are not supported by model
Return values
array<string|int, mixed>|falsegetCollection()
public
getCollection() : Mage_Catalog_Model_Resource_Product_Option_Collection
Return values
Mage_Catalog_Model_Resource_Product_Option_CollectiongetCreatedAt()
public
getCreatedAt() : string|null
Return values
string|nullgetData()
Object data getter
public
getData([string $key = '' ][, string|int $index = null ]) : mixed
If $key is not defined will return all the data as an array. Otherwise, it will return value of the element specified by $key. It is possible to use keys like a/b/c for access nested array data
If $index is specified it will assume that attribute data is an array and retrieve corresponding member. If data is the string - it will be explode by new line character and converted to array.
Parameters
- $key : string = ''
- $index : string|int = null
getDataByKey()
Get object data by particular key
public
getDataByKey(string $key) : mixed
Parameters
- $key : string
getDataByPath()
Get object data by path
public
getDataByPath(string $path) : mixed
Method consider the path as chain of keys: a/b/c => ['a']['b']['c']
Parameters
- $path : string
getDataSetDefault()
Fast get data or set default if value is not available
public
getDataSetDefault(string $key, mixed $default) : mixed
Parameters
- $key : string
- $default : mixed
getDataUsingMethod()
Get object data by key with calling getter method
public
getDataUsingMethod(string $key[, mixed $args = null ]) : mixed
Parameters
- $key : string
- $args : mixed = null
getEntityId()
public
getEntityId() : int
Return values
intgetFileExtension()
public
getFileExtension() : string|null
Return values
string|nullgetGroupByType()
Get group name of option by given option type
public
getGroupByType([string $type = null ]) : string
Parameters
- $type : string = null
Return values
stringgetId()
Retrieve model object identifier
public
getId() : int|string|null
Attributes
- #[Override]
Return values
int|string|nullgetIdFieldName()
Retrieve identifier field name for model
public
getIdFieldName() : string
Attributes
- #[Override]
Return values
stringgetImageSizeX()
public
getImageSizeX() : int|null
Return values
int|nullgetImageSizeY()
public
getImageSizeY() : int|null
Return values
int|nullgetIsRequire()
public
getIsRequire() : bool|null
Return values
bool|nullgetIsRequired()
Check if value is required
public
getIsRequired() : int
Return values
intgetMaxCharacters()
public
getMaxCharacters() : int|null
Return values
int|nullgetOptionId()
public
getOptionId() : int|null
Return values
int|nullgetOptions()
Get all options
public
getOptions() : array<string|int, mixed>
Return values
array<string|int, mixed>getOptionValuesByOptionId()
Get collection of values by given option ids
public
getOptionValuesByOptionId(array<string|int, mixed> $optionIds, int $storeId) : Mage_Catalog_Model_Resource_Product_Option_Value_Collection
Parameters
- $optionIds : array<string|int, mixed>
- $storeId : int
Return values
Mage_Catalog_Model_Resource_Product_Option_Value_CollectiongetOrigData()
Get object loaded data (original data)
public
getOrigData([string $key = null ]) : mixed
Parameters
- $key : string = null
getPrice()
Return price. If $flag is true and price is percent return converted percent to price
public
getPrice([bool $flag = false ]) : float
Parameters
- $flag : bool = false
Return values
floatgetPriceType()
public
getPriceType() : string|null
Return values
string|nullgetProduct()
Retrieve product instance
public
getProduct() : Mage_Catalog_Model_Product
Return values
Mage_Catalog_Model_ProductgetProductId()
public
getProductId() : int|string|null
Return values
int|string|nullgetProductOptionCollection()
get Product Option Collection
public
getProductOptionCollection(Mage_Catalog_Model_Product $product) : Mage_Catalog_Model_Resource_Product_Option_Collection
Parameters
- $product : Mage_Catalog_Model_Product
Return values
Mage_Catalog_Model_Resource_Product_Option_CollectiongetResource()
Retrieve model resource
public
getResource() : Mage_Catalog_Model_Resource_Product_Option
Return values
Mage_Catalog_Model_Resource_Product_OptiongetResourceCollection()
Get collection instance
public
getResourceCollection() : Mage_Core_Model_Resource_Db_Collection_Abstract
Tags
Return values
Mage_Core_Model_Resource_Db_Collection_AbstractgetResourceName()
Retrieve model resource name
public
getResourceName() : string
Return values
stringgetSearchableData()
Retrieve option searchable data
public
getSearchableData(int $productId, int $storeId) : array<string|int, mixed>
Parameters
- $productId : int
- $storeId : int
Return values
array<string|int, mixed>getShippingAddress()
public
getShippingAddress() : Mage_Customer_Model_Address_Abstract|null
Return values
Mage_Customer_Model_Address_Abstract|nullgetSku()
public
getSku() : string|null
Return values
string|nullgetSortOrder()
public
getSortOrder() : int|null
Return values
int|nullgetStoreId()
public
getStoreId() : int|null
Return values
int|nullgetStorePrice()
public
getStorePrice() : float|null
Return values
float|nullgetStoreTitle()
public
getStoreTitle() : string|null
Return values
string|nullgetTitle()
public
getTitle() : string|null
Return values
string|nullgetType()
public
getType() : string|null
Return values
string|nullgetValueById()
Get value by given id
public
getValueById(int|string $valueId) : Mage_Catalog_Model_Product_Option_Value
Parameters
- $valueId : int|string
Return values
Mage_Catalog_Model_Product_Option_ValuegetValueInstance()
Retrieve value instance
public
getValueInstance() : Mage_Catalog_Model_Product_Option_Value
Return values
Mage_Catalog_Model_Product_Option_ValuegetValues()
Get values
public
getValues() : array<string|int, Mage_Catalog_Model_Product_Option_Value>
Return values
array<string|int, Mage_Catalog_Model_Product_Option_Value>getValuesCollection()
Get collection of values for current option
public
getValuesCollection() : Mage_Catalog_Model_Resource_Product_Option_Value_Collection
Return values
Mage_Catalog_Model_Resource_Product_Option_Value_CollectiongroupFactory()
Group model factory
public
groupFactory(string $type) : Mage_Catalog_Model_Product_Option_Type_Default
Parameters
- $type : string
-
Option type
Return values
Mage_Catalog_Model_Product_Option_Type_DefaulthasData()
If $key is empty, checks whether there's any data in the object Otherwise checks if the specified attribute is set.
public
hasData([string $key = '' ]) : bool
Parameters
- $key : string = ''
Return values
boolhasDataChanges()
Get data change status
public
hasDataChanges() : bool
Return values
boolhasErrors()
public
hasErrors() : bool
Return values
boolisDeleted()
Set _isDeleted flag value (if $isDeleted param is defined) and return current flag value
public
isDeleted([bool $isDeleted = null ]) : bool
Parameters
- $isDeleted : bool = null
Return values
boolisDirty()
public
isDirty([string $field = null ]) : bool
Parameters
- $field : string = null
Return values
boolisEmpty()
checks whether the object is empty
public
isEmpty() : bool
Return values
boolisModuleEnabled()
public
isModuleEnabled(string $moduleName[, string $helperAlias = 'core' ]) : bool
Parameters
- $moduleName : string
- $helperAlias : string = 'core'
Return values
boolisMultipleType()
Check whether custom option could have multiple values
public
isMultipleType() : bool
Return values
boolisObjectNew()
Check object state (true - if it is object without id on object just created) This method can help detect if object just created in _afterSave method problem is what in after save object has id and we can't detect what object was created in this transaction
public
isObjectNew([bool $flag = null ]) : bool
Parameters
- $flag : bool = null
Return values
booljsonSerialize()
Implementation of JsonSerializable::jsonSerialize()
public
jsonSerialize() : array<string|int, mixed>
Prepares the object data for JSON serialization. Returns all object data as an array, with special handling for nested DataObject instances:
- If a nested DataObject has a custom jsonSerialize() implementation, it's preserved as-is
- If a nested DataObject has a custom toJson() method, it's converted to JSON string
- If a nested DataObject uses only the base implementations, it's excluded from output
This prevents infinite recursion and circular references when serializing object hierarchies.
Attributes
- #[Override]
Return values
array<string|int, mixed>load()
Load object data
public
load(string|null|int $id[, string|null $field = null ]) : $this
Parameters
- $id : string|null|int
- $field : string|null = null
Return values
$thisoffsetExists()
Implementation of ArrayAccess::offsetExists()
public
offsetExists(string $offset) : bool
Parameters
- $offset : string
Tags
Attributes
- #[Override]
Return values
booloffsetGet()
Implementation of ArrayAccess::offsetGet()
public
offsetGet(string $offset) : mixed
Parameters
- $offset : string
Tags
Attributes
- #[Override]
- #[ReturnTypeWillChange]
offsetSet()
Implementation of ArrayAccess::offsetSet()
public
offsetSet(string $offset, mixed $value) : void
Parameters
- $offset : string
- $value : mixed
Tags
Attributes
- #[Override]
offsetUnset()
Implementation of ArrayAccess::offsetUnset()
public
offsetUnset(string $offset) : void
Parameters
- $offset : string
Tags
Attributes
- #[Override]
prepareOptionForDuplicate()
Prepare array of options for duplicate
public
prepareOptionForDuplicate() : array<string|int, mixed>
Return values
array<string|int, mixed>save()
Save object data
public
save() : $this
Tags
Return values
$thissaveOptions()
Save options.
public
saveOptions() : $this
Return values
$thisserialize()
serialize object attributes
public
serialize([array<string|int, mixed> $attributes = [] ][, string $valueSeparator = '=' ][, string $fieldSeparator = ' ' ][, string $quote = '"' ]) : string
Parameters
- $attributes : array<string|int, mixed> = []
- $valueSeparator : string = '='
- $fieldSeparator : string = ' '
- $quote : string = '"'
Return values
stringsetAttribute()
public
setAttribute(Mage_Eav_Model_Entity_Attribute_Abstract $value) : $this
Parameters
Return values
$thissetCreatedAt()
public
setCreatedAt(string|null $value) : static
Parameters
- $value : string|null
Return values
staticsetData()
Overwrite data in the object.
public
setData(string|array<string|int, mixed> $key[, mixed $value = null ]) : $this
$key can be string or array. If $key is string, the attribute value will be overwritten by $value
If $key is an array, it will overwrite all the data in the object.
Parameters
- $key : string|array<string|int, mixed>
- $value : mixed = null
Return values
$thissetDataChanges()
Clears data changes status
public
setDataChanges(bool $value) : $this
Parameters
- $value : bool
Return values
$thissetDataUsingMethod()
Set object data with calling setter method
public
setDataUsingMethod(string $key[, mixed $args = [] ]) : $this
Parameters
- $key : string
- $args : mixed = []
Return values
$thissetFileExtension()
public
setFileExtension(string|null $value) : static
Parameters
- $value : string|null
Return values
staticsetId()
Declare model object identifier value
public
setId(mixed $id) : $this
Parameters
- $id : mixed
Attributes
- #[Override]
Return values
$thissetIdFieldName()
set name of object id field
public
setIdFieldName(string $name) : $this
Parameters
- $name : string
Return values
$thissetImageSizeX()
public
setImageSizeX(int|null $value) : static
Parameters
- $value : int|null
Return values
staticsetImageSizeY()
public
setImageSizeY(int|null $value) : static
Parameters
- $value : int|null
Return values
staticsetIsRequire()
public
setIsRequire([bool|null $value = true ]) : static
Parameters
- $value : bool|null = true
Return values
staticsetIsRequired()
Set value required
public
setIsRequired(int $value) : self
Parameters
- $value : int
Return values
selfsetMaxCharacters()
public
setMaxCharacters(int|null $value) : static
Parameters
- $value : int|null
Return values
staticsetOptionId()
public
setOptionId(int|null $value) : static
Parameters
- $value : int|null
Return values
staticsetOptions()
Set options for array
public
setOptions(array<string|int, mixed> $options) : $this
Parameters
- $options : array<string|int, mixed>
Return values
$thissetOrigData()
Initialize object original data
public
setOrigData([string $key = null ][, mixed $data = null ]) : $this
Parameters
- $key : string = null
- $data : mixed = null
Return values
$thissetProduct()
Set product instance
public
setProduct([Mage_Catalog_Model_Product|null $product = null ]) : $this
Parameters
- $product : Mage_Catalog_Model_Product|null = null
Return values
$thissetProductId()
public
setProductId(int|string|null $value) : static
Parameters
- $value : int|string|null
Return values
staticsetSku()
public
setSku(string|null $value) : static
Parameters
- $value : string|null
Return values
staticsetSortOrder()
public
setSortOrder(int|null $value) : static
Parameters
- $value : int|null
Return values
staticsetType()
public
setType(string|null $value) : static
Parameters
- $value : string|null
Return values
staticsetUpdatedAt()
public
setUpdatedAt(string|null $value) : static
Parameters
- $value : string|null
Return values
statictoArray()
Public wrapper for __toArray
public
toArray([array<string|int, mixed> $arrAttributes = [] ]) : array<string|int, mixed>
Parameters
- $arrAttributes : array<string|int, mixed> = []
Return values
array<string|int, mixed>toJson()
Public wrapper for __toJson
public
toJson([array<string|int, mixed> $arrAttributes = [] ]) : string
Parameters
- $arrAttributes : array<string|int, mixed> = []
Return values
stringtoString()
Public wrapper for __toString
public
toString([string $format = '' ]) : string
Will use $format as an template and substitute {{key}} for attributes
Parameters
- $format : string = ''
Return values
stringtoXml()
Public wrapper for __toXml
public
toXml([array<string|int, mixed> $arrAttributes = [] ][, string $rootName = 'item' ][, bool $addOpenTag = false ][, bool $addCdata = true ]) : string
Parameters
- $arrAttributes : array<string|int, mixed> = []
- $rootName : string = 'item'
- $addOpenTag : bool = false
- $addCdata : bool = true
Return values
stringunsetData()
Unset data from the object.
public
unsetData([string $key = null ]) : $this
$key can be a string only. Array will be ignored.
Parameters
- $key : string = null
Return values
$thisunsetOldData()
Unset old fields data from the object.
public
unsetOldData([string $key = null ]) : $this
$key can be a string only. Array will be ignored.
Parameters
- $key : string = null
Return values
$thisunsetOptions()
Set options to empty array
public
unsetOptions() : $this
Return values
$this__toJson()
Convert object attributes to JSON
protected
__toJson([array<string|int, mixed> $arrAttributes = [] ]) : string
Parameters
- $arrAttributes : array<string|int, mixed> = []
-
array of required attributes
Return values
string__toXml()
Convert object attributes to XML
protected
__toXml([array<string|int, mixed> $arrAttributes = [] ][, string $rootName = 'item' ][, bool $addOpenTag = false ][, bool $addCdata = true ]) : string
Parameters
- $arrAttributes : array<string|int, mixed> = []
-
array of required attributes
- $rootName : string = 'item'
-
name of the root element
- $addOpenTag : bool = false
- $addCdata : bool = true
Return values
string_addFullNames()
protected
_addFullNames() : mixed
_afterDelete()
Processing object after delete data
protected
_afterDelete() : $this
Return values
$this_afterDeleteCommit()
Processing manipulation after main transaction commit
protected
_afterDeleteCommit() : $this
Return values
$this_afterLoad()
Processing object after load data
protected
_afterLoad() : $this
Return values
$this_afterSave()
After save
protected
_afterSave() : Mage_Core_Model_Abstract
Attributes
- #[Override]
Return values
Mage_Core_Model_Abstract_beforeDelete()
Processing object before delete data
protected
_beforeDelete() : $this
Return values
$this_beforeLoad()
Processing object before load data
protected
_beforeLoad(int $id[, string|null $field = null ]) : $this
Parameters
- $id : int
- $field : string|null = null
Return values
$this_beforeSave()
Processing object before save data
protected
_beforeSave() : $this
Tags
Attributes
- #[Override]
Return values
$this_camelize()
protected
_camelize(string $name) : string
Parameters
- $name : string
Return values
string_clearData()
Clearing object's data
protected
_clearData() : $this
Attributes
- #[Override]
Return values
$this_clearReferences()
Clearing cyclic references
protected
_clearReferences() : $this
Attributes
- #[Override]
Return values
$this_construct()
Internal constructor not depended on params. Can be used for object initialization
protected
_construct() : void
Attributes
- #[Override]
_getData()
Get value from _data array without parse key
protected
_getData(string $key) : mixed
Parameters
- $key : string
_getEventData()
Get array of objects transferred to default events processing
protected
_getEventData() : array<string|int, mixed>
Return values
array<string|int, mixed>_hasModelChanged()
Check whether model has changed data.
protected
_hasModelChanged() : bool
Can be overloaded in child classes to perform advanced check whether model needs to be saved e.g. using resourceModel->hasDataChanged() or any other technique
Return values
bool_init()
Standard model initialization
protected
_init(string $resourceModel) : mixed
Parameters
- $resourceModel : string
_initOldFieldsMap()
Inits mapping array of object's previously used fields to new fields.
protected
_initOldFieldsMap() : mixed
Must be overloaded by descendants to set concrete fields map.
_prepareArray()
Set required array elements
protected
_prepareArray(array<string|int, mixed> &$arr[, array<string|int, mixed> $elements = [] ]) : array<string|int, mixed>
Parameters
- $arr : array<string|int, mixed>
- $elements : array<string|int, mixed> = []
Return values
array<string|int, mixed>_prepareSyncFieldsMap()
Called after old fields are inited. Forms synchronization map to sync old fields and new fields between each other.
protected
_prepareSyncFieldsMap() : $this
Return values
$this_protectFromNonAdmin()
Safeguard func that will check, if we are in admin area
protected
_protectFromNonAdmin() : mixed
Tags
_setResourceModel()
Set resource names
protected
_setResourceModel(string $resourceName[, string|null $resourceCollectionName = null ]) : mixed
If collection name is omitted, resource name will be used with _collection appended
Parameters
- $resourceName : string
- $resourceCollectionName : string|null = null
_underscore()
Converts field names for setters and getters
protected
_underscore(string $name) : string
$this->setMyField($value) === $this->setData('my_field', $value) Uses cache to eliminate unnecessary preg_replace
Parameters
- $name : string
Return values
stringvalidateFileExtensions()
Validate file extensions against forbidden list
protected
validateFileExtensions(string $extensions) : self
Parameters
- $extensions : string