◆ __construct()
OxidEsales\EshopCommunity\Core\Model\BaseModel::__construct |
( |
| ) |
|
Class constructor, sets active shop.
◆ __clone()
OxidEsales\EshopCommunity\Core\Model\BaseModel::__clone |
( |
| ) |
|
Magic function invoked on object cloning. Basically takes care about cloning properly DB fields.
◆ __get()
OxidEsales\EshopCommunity\Core\Model\BaseModel::__get |
( |
|
$variableName | ) |
|
Magic getter for older versions and template variables
- Parameters
-
string | $variableName | variable name |
- Returns
- mixed
◆ __isset()
OxidEsales\EshopCommunity\Core\Model\BaseModel::__isset |
( |
|
$variableName | ) |
|
Magic isset() handler. Workaround for detecting if protected properties are set.
- Parameters
-
mixed | $variableName | Supplied class variable |
- Returns
- bool
◆ __set()
OxidEsales\EshopCommunity\Core\Model\BaseModel::__set |
( |
|
$fieldName, |
|
|
|
$fieldValue |
|
) |
| |
Magic setter. If using lazy loading, adds setted field to fields array
- Parameters
-
string | $fieldName | name value |
mixed | $fieldValue | value |
◆ _addField()
OxidEsales\EshopCommunity\Core\Model\BaseModel::_addField |
( |
|
$fieldName, |
|
|
|
$fieldStatus, |
|
|
|
$type = null , |
|
|
|
$length = null |
|
) |
| |
|
protected |
Adds additional field to meta structure
- Parameters
-
string | $fieldName | Field name |
int | $fieldStatus | Field name status. In derived classes it indicates multi language status. |
string | $type | Field type |
string | $length | Field Length |
- Returns
- null
◆ _addSkippedSaveFieldsForMapping()
OxidEsales\EshopCommunity\Core\Model\BaseModel::_addSkippedSaveFieldsForMapping |
( |
| ) |
|
|
protected |
Add additional fields to skipped save fields
◆ _canFieldBeNull()
OxidEsales\EshopCommunity\Core\Model\BaseModel::_canFieldBeNull |
( |
|
$fieldName | ) |
|
|
protected |
check if db field can be null
- Parameters
-
string | $fieldName | db field name |
- Returns
- bool
◆ _disableLazyLoadingForCaching()
OxidEsales\EshopCommunity\Core\Model\BaseModel::_disableLazyLoadingForCaching |
( |
| ) |
|
|
protected |
Disable lazy loading if cache is enabled
◆ _getAllFields()
OxidEsales\EshopCommunity\Core\Model\BaseModel::_getAllFields |
( |
|
$returnSimple = false | ) |
|
|
protected |
Returns meta field or simple array of all object fields. This method is slow and normally is called before field cache is built. Make sure it is not called after first page is loaded and cache data is fully built (until tmp dir is cleaned).
- Parameters
-
bool | $returnSimple | Set $blReturnSimple to true when you need simple array (meta data array is returned otherwise) |
- See also
- \OxidEsales\Eshop\Core\Model\BaseModel::_getTableFields()
- Returns
- array
◆ _getFieldDefaultValue()
OxidEsales\EshopCommunity\Core\Model\BaseModel::_getFieldDefaultValue |
( |
|
$fieldName | ) |
|
|
protected |
returns default field value
- Parameters
-
string | $fieldName | db field name |
- Returns
- mixed
◆ _getFieldLongName()
OxidEsales\EshopCommunity\Core\Model\BaseModel::_getFieldLongName |
( |
|
$fieldName | ) |
|
|
protected |
Returns long field name in "<table>__<field_name>" format.
- Parameters
-
string | $fieldName | Short field name |
- Returns
- string
◆ _getFieldStatus()
OxidEsales\EshopCommunity\Core\Model\BaseModel::_getFieldStatus |
( |
|
$fieldName | ) |
|
|
protected |
Returns _aFieldName[] value. 0 means - non multi language, 1 - multi language field. But this is defined only in derived oxi18n class. In oxBase it is always 0, as oxBase treats all fields as non multi language.
- Parameters
-
string | $fieldName | Field name |
- Returns
- int
◆ _getNonCachedFieldNames()
OxidEsales\EshopCommunity\Core\Model\BaseModel::_getNonCachedFieldNames |
( |
|
$forceFullStructure = false | ) |
|
|
protected |
Returns the list of fields. This function is slower and its result is normally cached. Basically we have 3 separate cases here:
- We are in admin so we need extended info for all fields (name, field length and field type)
- Object is not lazy loaded so we will return all data fields as simple array, as we need only names
- Object is lazy loaded so we will return empty array as all fields are loaded on request (in __get()).
- Parameters
-
bool | $forceFullStructure | Whether to force loading of full data structure |
- Returns
- array|bool
◆ _getObjectViewName()
OxidEsales\EshopCommunity\Core\Model\BaseModel::_getObjectViewName |
( |
|
$table, |
|
|
|
$shopID = null |
|
) |
| |
|
protected |
Returns actual object view or table name
- Parameters
-
string | $table | Original table name |
int | $shopID | Shop ID |
- Returns
- string
◆ _getTableFields()
OxidEsales\EshopCommunity\Core\Model\BaseModel::_getTableFields |
( |
|
$table, |
|
|
|
$returnSimpleArray = false |
|
) |
| |
|
protected |
Returns meta field or simple array of all object fields. This method is slow and normally is called before field cache is built. Make sure it is not called after first page is loaded and cache data is fully built (until tmp dir is cleaned).
- Parameters
-
string | $table | Table name |
bool | $returnSimpleArray | Set $returnSimple to true when you need simple array (meta data array is returned otherwise) |
- Returns
- array
◆ _getUpdateFields()
OxidEsales\EshopCommunity\Core\Model\BaseModel::_getUpdateFields |
( |
|
$useSkipSaveFields = true | ) |
|
|
protected |
Get object fields sql part used for updates or inserts: return e.g. fldName1 = 'value1',fldName2 = 'value2'...
- Parameters
-
bool | $useSkipSaveFields | forces usage of skip save fields array (default is true) |
- Returns
- string
◆ _getUpdateFieldValue()
OxidEsales\EshopCommunity\Core\Model\BaseModel::_getUpdateFieldValue |
( |
|
$fieldName, |
|
|
|
$field |
|
) |
| |
|
protected |
returns quoted field value for using in update statement
- Parameters
-
string | $fieldName | name of field |
Field | $field | field object |
- Returns
- string
◆ _initDataStructure()
OxidEsales\EshopCommunity\Core\Model\BaseModel::_initDataStructure |
( |
|
$forceFullStructure = false | ) |
|
|
protected |
Initializes object data structure. Either by trying to load from cache or by calling $this->_getNonCachedFieldNames
- Parameters
-
bool | $forceFullStructure | Set to true if you want to load full structure in any case. |
◆ _insert()
OxidEsales\EshopCommunity\Core\Model\BaseModel::_insert |
( |
| ) |
|
|
protected |
Insert this Object into the database, this function only works on the main table, it will not save any dependent tables, which might be loaded through oxlist.
- Returns
- bool
◆ _isDisabledFieldCache()
OxidEsales\EshopCommunity\Core\Model\BaseModel::_isDisabledFieldCache |
( |
| ) |
|
|
protected |
Checks if current class disables field caching. This method is primary used in unit tests.
- Returns
- bool
◆ _isInList()
OxidEsales\EshopCommunity\Core\Model\BaseModel::_isInList |
( |
| ) |
|
|
protected |
Checks if this instance is one of oxList elements.
- Returns
- bool
◆ _removeElement2ShopRelations()
OxidEsales\EshopCommunity\Core\Model\BaseModel::_removeElement2ShopRelations |
( |
|
$oxid | ) |
|
|
protected |
Removes relevant mapping data for selected object if it is a multishop inheritable table
- Parameters
-
◆ _setFieldData()
OxidEsales\EshopCommunity\Core\Model\BaseModel::_setFieldData |
( |
|
$fieldName, |
|
|
|
$fieldValue, |
|
|
|
$dataType = Field::T_TEXT |
|
) |
| |
|
protected |
Sets data field value
- Parameters
-
string | $fieldName | Index OR name (eg. 'oxarticles__oxtitle') of a data field to set |
string | $fieldValue | Value of data field |
int | $dataType | Field type |
◆ _setUpdateSeoOnFieldChange()
OxidEsales\EshopCommunity\Core\Model\BaseModel::_setUpdateSeoOnFieldChange |
( |
|
$fieldName | ) |
|
|
protected |
Checks whether certain field has changed, and sets update seo flag if needed. It can only set the value to false, so it allows for multiple calls to the method, and if atleast one requires seo update, other checks won't override that.
- Parameters
-
string | $fieldName | Field name that will be checked |
◆ _update()
OxidEsales\EshopCommunity\Core\Model\BaseModel::_update |
( |
| ) |
|
|
protected |
Update this Object into the database, this function only works on the main table, it will not save any dependent tables, which might be loaded through oxList.
- Exceptions
-
oxObjectException | Throws on failure inserting |
DatabaseException | On database errors |
- Returns
- bool Will always return true. On failure an exception is thrown.
◆ addFieldName()
OxidEsales\EshopCommunity\Core\Model\BaseModel::addFieldName |
( |
|
$name | ) |
|
Adds additional field name to meta structure
- Parameters
-
◆ addSqlActiveRangeSnippet()
OxidEsales\EshopCommunity\Core\Model\BaseModel::addSqlActiveRangeSnippet |
( |
|
$query, |
|
|
|
$tableName |
|
) |
| |
|
protected |
adds and activefrom/activeto to the query
- Parameters
-
string | $query | |
string | $tableName | |
- Returns
- string
◆ allowDerivedDelete()
OxidEsales\EshopCommunity\Core\Model\BaseModel::allowDerivedDelete |
( |
| ) |
|
Checks if derived delete is allowed (calls \OxidEsales\Eshop\Core\Model\BaseModel::isDerived)
- Returns
- bool
◆ allowDerivedUpdate()
OxidEsales\EshopCommunity\Core\Model\BaseModel::allowDerivedUpdate |
( |
| ) |
|
Checks if derived update is allowed (calls \OxidEsales\Eshop\Core\Model\BaseModel::isDerived)
- Returns
- bool
◆ assign()
OxidEsales\EshopCommunity\Core\Model\BaseModel::assign |
( |
|
$dbRecord | ) |
|
Assigns DB field values to object fields. Returns true on success.
- Parameters
-
array | $dbRecord | Associative data values array |
- Returns
- null
◆ assignRecord()
OxidEsales\EshopCommunity\Core\Model\BaseModel::assignRecord |
( |
|
$select | ) |
|
Performs SQL query, assigns record field values to object. Returns true on success.
- Parameters
-
string | $select | SQL statement |
- Returns
- bool
◆ beforeUpdate()
OxidEsales\EshopCommunity\Core\Model\BaseModel::beforeUpdate |
( |
|
$oxid = null | ) |
|
This function is triggered before the record is updated. If you make any update to the database record manually you should also call beforeUpdate() from your script.
- Parameters
-
string | $oxid | Object ID(default null). Pass the ID in case object is not loaded. |
◆ buildSelectString()
OxidEsales\EshopCommunity\Core\Model\BaseModel::buildSelectString |
( |
|
$whereCondition = null | ) |
|
Builds and returns SQL query string.
- Parameters
-
null | array | $whereCondition | SQL select WHERE conditions array (default false) |
- Returns
- string
◆ checkFieldCanBeUpdated()
OxidEsales\EshopCommunity\Core\Model\BaseModel::checkFieldCanBeUpdated |
( |
|
$fieldName | ) |
|
|
protected |
If needed, check if field can be updated
- Parameters
-
- Returns
- bool
◆ checkIfCoreTableNeeded()
OxidEsales\EshopCommunity\Core\Model\BaseModel::checkIfCoreTableNeeded |
( |
|
$forceCoreTableUsage | ) |
|
|
protected |
Additional check if core table name should be returned in getViewName
- Parameters
-
mixed | $forceCoreTableUsage | |
- Returns
- mixed
◆ delete()
OxidEsales\EshopCommunity\Core\Model\BaseModel::delete |
( |
|
$oxid = null | ) |
|
Delete this object from the database, returns true if entry was deleted.
- Parameters
-
string | $oxid | Object ID(default null) |
- Returns
- bool
◆ disableLazyLoading()
OxidEsales\EshopCommunity\Core\Model\BaseModel::disableLazyLoading |
( |
| ) |
|
Disables lazy loading mechanism and init object fully
◆ executeDatabaseQuery()
OxidEsales\EshopCommunity\Core\Model\BaseModel::executeDatabaseQuery |
( |
|
$query | ) |
|
|
protected |
Execute a query on the database.
- Parameters
-
string | $query | The command to execute on the database. |
- Returns
- int The number of affected rows.
◆ exists()
OxidEsales\EshopCommunity\Core\Model\BaseModel::exists |
( |
|
$oxid = null | ) |
|
Checks if this object exists, returns true on success.
- Parameters
-
string | $oxid | Object ID(default null) |
- Returns
- bool
◆ getClassName()
OxidEsales\EshopCommunity\Core\Model\BaseModel::getClassName |
( |
| ) |
|
Returns object class name
- Returns
- string
◆ getContainer()
OxidEsales\EshopCommunity\Core\Model\BaseModel::getContainer |
( |
| ) |
|
|
protected |
◆ getCoreTableName()
OxidEsales\EshopCommunity\Core\Model\BaseModel::getCoreTableName |
( |
| ) |
|
Return object core table name
- Returns
- string
◆ getFieldData()
OxidEsales\EshopCommunity\Core\Model\BaseModel::getFieldData |
( |
|
$fieldName | ) |
|
Gets field data
- Parameters
-
string | $fieldName | name (eg. 'oxtitle') of a data field to get |
- Returns
- mixed value of a data field
◆ getFieldNames()
OxidEsales\EshopCommunity\Core\Model\BaseModel::getFieldNames |
( |
| ) |
|
Returns array with object field names
- Returns
- array
◆ getGetterViewName()
OxidEsales\EshopCommunity\Core\Model\BaseModel::getGetterViewName |
( |
| ) |
|
|
protected |
Get view name for magic getter
- Returns
- string
◆ getId()
OxidEsales\EshopCommunity\Core\Model\BaseModel::getId |
( |
| ) |
|
Returns unique object id.
- Returns
- string
◆ getLanguage()
OxidEsales\EshopCommunity\Core\Model\BaseModel::getLanguage |
( |
| ) |
|
Returns -1, means object is not multi language
- Returns
- int
◆ getRecordByQuery()
OxidEsales\EshopCommunity\Core\Model\BaseModel::getRecordByQuery |
( |
|
$query | ) |
|
|
protected |
Get record
- Parameters
-
- Returns
- mixed
◆ getSecondsToRoundForQueryCache()
OxidEsales\EshopCommunity\Core\Model\BaseModel::getSecondsToRoundForQueryCache |
( |
| ) |
|
|
protected |
Return a number of seconds used to define a interval for rounding timestamps e.g. this method returns the value 60 then it means timestamps should be rounded to full minutes so the query may get an cache hit because it can be stable for an interval of one minute
it is a own method to allow overriding in child classes
- Returns
- int the amount of seconds
◆ getSelectFields()
OxidEsales\EshopCommunity\Core\Model\BaseModel::getSelectFields |
( |
|
$forceCoreTableUsage = null | ) |
|
Function builds the field list used in select.
- Parameters
-
bool | $forceCoreTableUsage | (optional) use core views |
- Returns
- string
◆ getShopId()
OxidEsales\EshopCommunity\Core\Model\BaseModel::getShopId |
( |
| ) |
|
Return original object shop id
- Returns
- int
◆ getSqlActiveSnippet()
OxidEsales\EshopCommunity\Core\Model\BaseModel::getSqlActiveSnippet |
( |
|
$forceCoreTable = null | ) |
|
Returns SQL select string with checks if items are available
- Parameters
-
bool | $forceCoreTable | forces core table usage (optional) |
- Returns
- string
◆ getUpdateSeo()
OxidEsales\EshopCommunity\Core\Model\BaseModel::getUpdateSeo |
( |
| ) |
|
Returns update seo flag
- Returns
- boolean
◆ getUseSkipSaveFields()
OxidEsales\EshopCommunity\Core\Model\BaseModel::getUseSkipSaveFields |
( |
| ) |
|
Getting use skip fields or not
- Returns
- bool
◆ getViewName()
OxidEsales\EshopCommunity\Core\Model\BaseModel::getViewName |
( |
|
$forceCoreTableUsage = null | ) |
|
Returns main table data is actually selected from (could be a view name as well)
- Parameters
-
bool | $forceCoreTableUsage | (optional) use core views |
- Returns
- string
◆ init()
OxidEsales\EshopCommunity\Core\Model\BaseModel::init |
( |
|
$tableName = null , |
|
|
|
$forceAllFields = false |
|
) |
| |
Sets the names to main and view tables, loads metadata of each table.
- Parameters
-
string | $tableName | Name of DB object table |
bool | $forceAllFields | Forces initialisation of all fields overriding lazy loading functionality |
◆ isDerived()
OxidEsales\EshopCommunity\Core\Model\BaseModel::isDerived |
( |
| ) |
|
Returns true in case the item represented by this object is derived from parent shop
- Returns
- bool
◆ isLoaded()
OxidEsales\EshopCommunity\Core\Model\BaseModel::isLoaded |
( |
| ) |
|
Returns object "loaded" state
- Returns
- bool
◆ isMultiLang()
OxidEsales\EshopCommunity\Core\Model\BaseModel::isMultiLang |
( |
| ) |
|
Returns true, if object has multi language fields (if object is derived from oxi18n class). In oxBase it is always returns false, as oxBase treats all fields as non multi language.
- Returns
- bool
◆ isOx()
OxidEsales\EshopCommunity\Core\Model\BaseModel::isOx |
( |
| ) |
|
Checks if object ID's first two chars are 'o' and 'x'. Returns true or false
- Returns
- bool
◆ isPropertyField()
OxidEsales\EshopCommunity\Core\Model\BaseModel::isPropertyField |
( |
|
$name | ) |
|
|
private |
Returns true if the property is a Field.
- Parameters
-
- Returns
- bool
◆ isPropertyLoaded()
OxidEsales\EshopCommunity\Core\Model\BaseModel::isPropertyLoaded |
( |
|
$name | ) |
|
Returns true if the property is loaded.
- Parameters
-
- Returns
- bool
◆ isReadOnly()
OxidEsales\EshopCommunity\Core\Model\BaseModel::isReadOnly |
( |
| ) |
|
Is object readonly
- Returns
- bool
◆ load()
OxidEsales\EshopCommunity\Core\Model\BaseModel::load |
( |
|
$oxid | ) |
|
Loads object data from DB (object data ID is passed to method). Returns true on success. could throw oxObjectException F ?
- Parameters
-
- Returns
- bool
◆ modifyCacheKey()
OxidEsales\EshopCommunity\Core\Model\BaseModel::modifyCacheKey |
( |
|
$cacheKey, |
|
|
|
$override = false |
|
) |
| |
Lazy loading cache key modifier.
- Parameters
-
string | $cacheKey | Cache key |
bool | $override | Marker to force override cache key |
◆ onChange()
OxidEsales\EshopCommunity\Core\Model\BaseModel::onChange |
( |
|
$action = null , |
|
|
|
$oxid = null |
|
) |
| |
This function is triggered whenever the object is saved or deleted. onChange() is triggered after saving the changes in Save() method, after deleting the instance from the database. If you make any change to the database record manually you should also call onChange() from your script.
- Parameters
-
int | $action | Action identifier. |
string | $oxid | Object ID(default null). Pass the ID in case object is not loaded. |
◆ oxClone()
OxidEsales\EshopCommunity\Core\Model\BaseModel::oxClone |
( |
|
$object | ) |
|
Clone this object - similar to Copy Constructor.
- Parameters
-
object | $object | Object to copy |
◆ save()
OxidEsales\EshopCommunity\Core\Model\BaseModel::save |
( |
| ) |
|
Save this Object to database, insert or update as needed.
- Exceptions
-
- Returns
- string|bool
◆ setId()
OxidEsales\EshopCommunity\Core\Model\BaseModel::setId |
( |
|
$oxid = null | ) |
|
Sets unique object id
- Parameters
-
- Returns
- string
◆ setInList()
OxidEsales\EshopCommunity\Core\Model\BaseModel::setInList |
( |
| ) |
|
Sets item as list element
◆ setIsDerived()
OxidEsales\EshopCommunity\Core\Model\BaseModel::setIsDerived |
( |
|
$value | ) |
|
Returns true in case the item represented by this object is derived from parent shop
- Parameters
-
◆ setReadOnly()
OxidEsales\EshopCommunity\Core\Model\BaseModel::setReadOnly |
( |
|
$readOnly | ) |
|
Set object readonly
- Parameters
-
bool | $readOnly | readonly flag |
◆ setShopId()
OxidEsales\EshopCommunity\Core\Model\BaseModel::setShopId |
( |
|
$shopId | ) |
|
Sets original object shop ID
- Parameters
-
◆ setUpdateSeo()
OxidEsales\EshopCommunity\Core\Model\BaseModel::setUpdateSeo |
( |
|
$updateSeo | ) |
|
Sets update seo flag
- Parameters
-
◆ setUseSkipSaveFields()
OxidEsales\EshopCommunity\Core\Model\BaseModel::setUseSkipSaveFields |
( |
|
$useSkipSaveFields | ) |
|
Setting use skip fields or not
- Parameters
-
bool | $useSkipSaveFields | - true or false |
◆ $_aFieldNames
OxidEsales\EshopCommunity\Core\Model\BaseModel::$_aFieldNames = ['oxid' => 0] |
|
protected |
◆ $_aInnerLazyCache
OxidEsales\EshopCommunity\Core\Model\BaseModel::$_aInnerLazyCache = null |
|
protected |
◆ $_aSkipSaveFields
OxidEsales\EshopCommunity\Core\Model\BaseModel::$_aSkipSaveFields = ['oxtimestamp'] |
|
protected |
◆ $_blDisableFieldCaching
OxidEsales\EshopCommunity\Core\Model\BaseModel::$_blDisableFieldCaching = [] |
|
staticprotected |
◆ $_blEmployMultilanguage
OxidEsales\EshopCommunity\Core\Model\BaseModel::$_blEmployMultilanguage = false |
|
protected |
◆ $_blIsDerived
OxidEsales\EshopCommunity\Core\Model\BaseModel::$_blIsDerived = null |
|
protected |
◆ $_blIsInList
OxidEsales\EshopCommunity\Core\Model\BaseModel::$_blIsInList = false |
|
protected |
◆ $_blIsSeoObject
OxidEsales\EshopCommunity\Core\Model\BaseModel::$_blIsSeoObject = false |
|
protected |
◆ $_blIsSimplyClonable
OxidEsales\EshopCommunity\Core\Model\BaseModel::$_blIsSimplyClonable = true |
|
protected |
◆ $_blReadOnly
OxidEsales\EshopCommunity\Core\Model\BaseModel::$_blReadOnly = false |
|
protected |
◆ $_blUpdateSeo
OxidEsales\EshopCommunity\Core\Model\BaseModel::$_blUpdateSeo = true |
|
protected |
◆ $_blUseLazyLoading
OxidEsales\EshopCommunity\Core\Model\BaseModel::$_blUseLazyLoading = false |
|
protected |
◆ $_blUseSkipSaveFields
OxidEsales\EshopCommunity\Core\Model\BaseModel::$_blUseSkipSaveFields = true |
|
protected |
◆ $_iShopId
OxidEsales\EshopCommunity\Core\Model\BaseModel::$_iShopId = null |
|
protected |
◆ $_isLoaded
OxidEsales\EshopCommunity\Core\Model\BaseModel::$_isLoaded = false |
|
protected |
◆ $_sCacheKey
OxidEsales\EshopCommunity\Core\Model\BaseModel::$_sCacheKey = null |
|
protected |
◆ $_sClassName
OxidEsales\EshopCommunity\Core\Model\BaseModel::$_sClassName = 'oxbase' |
|
protected |
◆ $_sCoreTable
OxidEsales\EshopCommunity\Core\Model\BaseModel::$_sCoreTable = null |
|
protected |
◆ $_sExistKey
OxidEsales\EshopCommunity\Core\Model\BaseModel::$_sExistKey = 'oxid' |
|
protected |
◆ $_sOXID
OxidEsales\EshopCommunity\Core\Model\BaseModel::$_sOXID = null |
|
protected |
◆ $_sViewTable
OxidEsales\EshopCommunity\Core\Model\BaseModel::$_sViewTable = null |
|
protected |
The documentation for this class was generated from the following file: