OXID eShop CE  6.1.5
OxidEsales\EshopCommunity\Core\Model\MultiLanguageModel Class Reference
+ Inheritance diagram for OxidEsales\EshopCommunity\Core\Model\MultiLanguageModel:
+ Collaboration diagram for OxidEsales\EshopCommunity\Core\Model\MultiLanguageModel:

Public Member Functions

 __construct ()
 
 setLanguage ($lang=null)
 
 getLanguage ()
 
 setEnableMultilang ($employMultilanguage)
 
 isMultilingualField ($fieldName)
 
 isMultilang ()
 
 loadInLang ($language, $oxid)
 
 modifyCacheKey ($cacheKey, $override=false)
 
 getAvailableInLangs ()
 
 getUpdateSqlFieldName ($field)
 
 delete ($oxid=null)
 

Protected Member Functions

 _getFieldStatus ($fieldName)
 
 _getNonCachedFieldNames ($forceFullStructure=false)
 
 _getFieldLang ($fieldName)
 
 _setUpdateSeoOnFieldChange ($field)
 
 _getUpdateFieldsForTable ($table, $useSkipSaveFields=true)
 
 checkFieldCanBeUpdated ($fieldName)
 
 _getUpdateFields ($useSkipSaveFields=true)
 
 _update ()
 
 _getLanguageSetTables ($coreTableName=null)
 
 _insert ()
 
 _getObjectViewName ($table, $shopID=null)
 
 _getAllFields ($returnSimple=false)
 
 _addField ($name, $status, $type=null, $length=null)
 
 _canFieldBeNull ($fieldName)
 

Protected Attributes

 $_sClassName = 'oxI18n'
 
 $_iLanguage = null
 
 $_blEmployMultilanguage = true
 

Detailed Description

Class handling multilanguage data fields

Constructor & Destructor Documentation

◆ __construct()

OxidEsales\EshopCommunity\Core\Model\MultiLanguageModel::__construct ( )

Class constructor, initiates parent constructor (parent::oxBase()).

Member Function Documentation

◆ _addField()

OxidEsales\EshopCommunity\Core\Model\MultiLanguageModel::_addField (   $name,
  $status,
  $type = null,
  $length = null 
)
protected

Adds additional field to meta structure. Skips language fields

Parameters
string$nameField name
string$statusField status (0-non multilang field, 1-multilang field)
string$typeField type
string$lengthField Length
Returns
null;

◆ _canFieldBeNull()

OxidEsales\EshopCommunity\Core\Model\MultiLanguageModel::_canFieldBeNull (   $fieldName)
protected

check if db field can be null for multilingual fields it checks only the base fields as they may be coming from outer join views, so oxbase would return that they always support null (while in reality updates to their lang set table with null would fail)

Parameters
string$fieldNamedb field name
Returns
bool

◆ _getAllFields()

OxidEsales\EshopCommunity\Core\Model\MultiLanguageModel::_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$returnSimpleSet $returnSimple to true when you need simple array (meta data array is returned otherwise)
See also
\OxidEsales\Eshop\Core\Model\BaseModel::_getTableFields()
Returns
array

◆ _getFieldLang()

OxidEsales\EshopCommunity\Core\Model\MultiLanguageModel::_getFieldLang (   $fieldName)
protected

Gets multilanguage field language. In case of oxtitle_2 it will return 2. 0 is returned if language ending is not defined.

Parameters
string$fieldNameField name
Returns
bool

◆ _getFieldStatus()

OxidEsales\EshopCommunity\Core\Model\MultiLanguageModel::_getFieldStatus (   $fieldName)
protected

Returns _aFieldName[] value. 0 means - non multilanguage, 1 - multilanguage field. This method is slow, so we should make sure it is called only when tmp dir is cleaned (and then the results are cached).

Parameters
string$fieldNameField name
Returns
int

◆ _getLanguageSetTables()

OxidEsales\EshopCommunity\Core\Model\MultiLanguageModel::_getLanguageSetTables (   $coreTableName = null)
protected

Return all DB tables for the language sets

Parameters
string$coreTableNamecore table name [optional]
Returns
array

◆ _getNonCachedFieldNames()

OxidEsales\EshopCommunity\Core\Model\MultiLanguageModel::_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:

  1. We are in admin so we need extended info for all fields (name, field length and field type)
  2. Object is not lazy loaded so we will return all data fields as simple array, as we need only names
  3. Object is lazy loaded so we will return empty array as all fields are loaded on request (in __get()).
Parameters
bool$forceFullStructureWhether to force loading of full data structure
Returns
array

◆ _getObjectViewName()

OxidEsales\EshopCommunity\Core\Model\MultiLanguageModel::_getObjectViewName (   $table,
  $shopID = null 
)
protected

Returns actual object view or table name

Parameters
string$tableOriginal table name
int$shopIDShop ID
Returns
string

◆ _getUpdateFields()

OxidEsales\EshopCommunity\Core\Model\MultiLanguageModel::_getUpdateFields (   $useSkipSaveFields = true)
protected

Get object fields sql part for base table used for updates or inserts: return e.g. fldName1 = 'value1',fldName2 = 'value2'...

Parameters
bool$useSkipSaveFieldsforces usage of skip save fields array (default is true)
Returns
string

◆ _getUpdateFieldsForTable()

OxidEsales\EshopCommunity\Core\Model\MultiLanguageModel::_getUpdateFieldsForTable (   $table,
  $useSkipSaveFields = true 
)
protected

return update fields SQL part

Parameters
string$tabletable name to be updated
bool$useSkipSaveFieldsuse skip save fields array?
Returns
string

◆ _insert()

OxidEsales\EshopCommunity\Core\Model\MultiLanguageModel::_insert ( )
protected

Insert this Object into the database, this function only works on the main table, it will not save any dependend tables, which might be loaded through oxlist.

Returns
bool

◆ _setUpdateSeoOnFieldChange()

OxidEsales\EshopCommunity\Core\Model\MultiLanguageModel::_setUpdateSeoOnFieldChange (   $field)
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. Will try to get multilang table name for relevant field check.

Parameters
string$fieldField name that will be checked

◆ _update()

OxidEsales\EshopCommunity\Core\Model\MultiLanguageModel::_update ( )
protected

Update this Object into the database, this function only works on the main table, it will not save any dependend tables, which might be loaded through oxlist (with exception of the active language set table, which will be updated).

Exceptions
oxObjectExceptionThrows on failure inserting
Returns
bool

◆ checkFieldCanBeUpdated()

OxidEsales\EshopCommunity\Core\Model\MultiLanguageModel::checkFieldCanBeUpdated (   $fieldName)
protected

If needed, check if field can be updated

Parameters
string$fieldName
Returns
bool

◆ delete()

OxidEsales\EshopCommunity\Core\Model\MultiLanguageModel::delete (   $oxid = null)

Delete this object from the database, returns true on success.

Parameters
string$oxidObject ID(default null)
Returns
bool

◆ getAvailableInLangs()

OxidEsales\EshopCommunity\Core\Model\MultiLanguageModel::getAvailableInLangs ( )

Returns an array of languages in which object multilanguage fields are already setted

Returns
array

◆ getLanguage()

OxidEsales\EshopCommunity\Core\Model\MultiLanguageModel::getLanguage ( )

Returns object language

Returns
int

◆ getUpdateSqlFieldName()

OxidEsales\EshopCommunity\Core\Model\MultiLanguageModel::getUpdateSqlFieldName (   $field)

Returns DB field name for update.

Parameters
string$fieldField name
Returns
string

◆ isMultilang()

OxidEsales\EshopCommunity\Core\Model\MultiLanguageModel::isMultilang ( )

Returns true, if object has multilanguage fields. In oxi18n it is always returns true.

Returns
bool

◆ isMultilingualField()

OxidEsales\EshopCommunity\Core\Model\MultiLanguageModel::isMultilingualField (   $fieldName)

Checks if this field is multlingual (returns false if language = 0)

Parameters
string$fieldNameField name
Returns
bool

◆ loadInLang()

OxidEsales\EshopCommunity\Core\Model\MultiLanguageModel::loadInLang (   $language,
  $oxid 
)

Loads object data from DB in passed language, returns true on success.

Parameters
integer$languageLoad this language compatible data
string$oxidobject ID
Returns
bool

◆ modifyCacheKey()

OxidEsales\EshopCommunity\Core\Model\MultiLanguageModel::modifyCacheKey (   $cacheKey,
  $override = false 
)

Lazy loading cache key modifier.

Parameters
string$cacheKeykache key
bool$overridemarker to force override cache key

◆ setEnableMultilang()

OxidEsales\EshopCommunity\Core\Model\MultiLanguageModel::setEnableMultilang (   $employMultilanguage)

Object multilanguage mode setter (set true to enable multilang mode). This setter affects init() method so it should be called before init() is executed

Parameters
bool$employMultilanguageNew $this->_blEmployMultilanguage value

◆ setLanguage()

OxidEsales\EshopCommunity\Core\Model\MultiLanguageModel::setLanguage (   $lang = null)

Sets object language.

Parameters
string$langstring (default null)

Member Data Documentation

◆ $_blEmployMultilanguage

OxidEsales\EshopCommunity\Core\Model\MultiLanguageModel::$_blEmployMultilanguage = true
protected

◆ $_iLanguage

OxidEsales\EshopCommunity\Core\Model\MultiLanguageModel::$_iLanguage = null
protected

◆ $_sClassName

OxidEsales\EshopCommunity\Core\Model\MultiLanguageModel::$_sClassName = 'oxI18n'
protected

The documentation for this class was generated from the following file: