Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes

oxBase Class Reference

Inheritance diagram for oxBase:
Collaboration diagram for oxBase:

List of all members.

Public Member Functions

 __construct ()
 __set ($sName, $sValue)
 __get ($sName)
 __isset ($mVar)
 __clone ()
 oxClone ($oObject)
 init ($sTableName=null, $blForceAllFields=false)
 assign ($dbRecord)
 getClassName ()
 getCoreTableName ()
 getId ()
 setId ($sOXID=null)
 setShopId ($iShopId)
 getShopId ()
 getViewName ($blForceCoreTableUsage=null)
 modifyCacheKey ($sCacheKey, $blOverride=false)
 disableLazyLoading ()
 isDerived ()
 setIsDerived ($blVal)
 isMultilang ()
 load ($sOXID)
 isLoaded ()
 buildSelectString ($aWhere=null)
 assignRecord ($sSelect)
 getFieldData ($sFieldName)
 getSelectFields ($blForceCoreTableUsage=null)
 delete ($sOXID=null)
 save ()
 allowDerivedUpdate ()
 allowDerivedDelete ()
 exists ($sOXID=null)
 getSqlActiveSnippet ($blForceCoreTable=null)
 validate ()
 beforeUpdate ($sOXID=null)
 onChange ($iAction=null, $sOXID=null)
 hasErrors ()
 getErrors ()
 getError ($sField)
 getHtmlError ($sField)
 setInList ()
 isOx ()
 isReadOnly ()
 setReadOnly ($blReadOnly)
 getFieldNames ()
 addFieldName ($sName)
 getLanguage ()

Protected Member Functions

 _isInList ()
 _getObjectViewName ($sTable, $sShopID=null)
 _getTableFields ($sTable, $blReturnSimple=false)
 _getAllFields ($blReturnSimple=false)
 _initDataStructure ($blForceFullStructure=false)
 _getNonCachedFieldNames ($blForceFullStructure=false)
 _getFieldStatus ($sFieldName)
 _addField ($sName, $iStatus, $sType=null, $sLength=null)
 _getFieldLongName ($sFieldName)
 _setFieldData ($sFieldName, $sValue, $iDataType=oxField::T_TEXT)
 _canFieldBeNull ($sFieldName)
 _getFieldDefaultValue ($sFieldName)
 _getUpdateFieldValue ($sFieldName, $oField)
 _getUpdateFields ($blUseSkipSaveFields=true)
 _update ()
 _insert ()
 _rebuildCache ()
 _setRecordNumber ($sMaxField, $aWhere=null, $iMaxTryCnt=5)
 _isDisabledFieldCache ()

Protected Attributes

 $_sOXID = null
 $_iShopId = null
 $_blIsSimplyClonable = true
 $_aErrors = array()
 $_sClassName = 'oxbase'
 $_sCoreTable = null
 $_sCoreTbl = null
 $_sViewTable = null
 $_aFieldNames = array('oxid' => 0)
 $_blIsNewCache = false
 $_sCacheKey = null
 $_blUseLazyLoading = false
 $_aSkipSaveFields = array()
 $_sExistKey = "oxid"
 $_blIsDerived = null
 $_blIsSeoObject = false
 $_blReadOnly = false
 $_blIsInList = false
 $_isLoaded = false
 $_aInnerLazyCache = null
 $_blEmployMultilanguage = false

Static Protected Attributes

static $_blDisableFieldCaching = array()

Detailed Description

Base class associated with database record

Definition at line 16 of file oxbase.php.


Constructor & Destructor Documentation

oxBase.__construct (  ) 

Member Function Documentation

oxBase.__clone (  ) 

Magic fuinction invoked on object cloning. Basically takes care about cloning properly DB fields.

Returns:
null;

Definition at line 327 of file oxbase.php.

oxBase.__get ( sName  ) 

Magic getter for older versions and template variables

Parameters:
string $sName variable name
Returns:
mixed

Reimplemented in oxOrder, oxUser, oxUserPayment, and oxVoucher.

Definition at line 228 of file oxbase.php.

oxBase.__isset ( mVar  ) 

Magic isset() handler. Workaround for detecting if protected properties are set.

Parameters:
mixed $mVar Supplied class variable
Returns:
bool

Definition at line 317 of file oxbase.php.

oxBase.__set ( sName,
sValue 
)

Magic setter. If using lazy loading, adds setted field to fields array

Parameters:
string $sName name value
mixed $sValue value
Returns:
null

Definition at line 206 of file oxbase.php.

oxBase._addField ( sName,
iStatus,
sType = null,
sLength = null 
) [protected]

Adds additional field to meta structure

Parameters:
string $sName Field name
int $iStatus Field name status. In derived classes it indicates multilanguage status.
string $sType Field type
string $sLength Field Length
Returns:
null;

Reimplemented in oxI18n.

Definition at line 1168 of file oxbase.php.

oxBase._canFieldBeNull ( sFieldName  )  [protected]

check if db field can be null

Parameters:
string $sFieldName db field name
Returns:
bool

Reimplemented in oxI18n.

Definition at line 1271 of file oxbase.php.

oxBase._getAllFields ( blReturnSimple = 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 $blReturnSimple Set $blReturnSimple to true when you need simple array (meta data array is returned otherwise)
See also:
oxBase._getTableFields()
Returns:
array

Reimplemented in oxI18n.

Definition at line 1053 of file oxbase.php.

oxBase._getFieldDefaultValue ( sFieldName  )  [protected]

returns default field value

Parameters:
string $sFieldName db field name
Returns:
mixed

Definition at line 1290 of file oxbase.php.

oxBase._getFieldLongName ( sFieldName  )  [protected]

Returns long field name in "<table>__<field_name>" format.

Parameters:
string $sFieldName Short field name
Returns:
string

Reimplemented in oxOrderFile.

Definition at line 1211 of file oxbase.php.

oxBase._getFieldStatus ( sFieldName  )  [protected]

Returns _aFieldName[] value. 0 means - non multilanguage, 1 - multilanguage field. But this is defined only in derived oxi18n class. In oxBase it is always 0, as oxBase treats all fields as non multilanguage.

Parameters:
string $sFieldName Field name
Returns:
int

Reimplemented in oxI18n.

Definition at line 1153 of file oxbase.php.

oxBase._getNonCachedFieldNames ( blForceFullStructure = 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 nede only names 3. Object is lazy loaded so we will return empty array as all fields are loaded on request (in __get()).

Parameters:
bool $blForceFullStructure Whether to force loading of full data structure
Returns:
array

Reimplemented in oxI18n.

Definition at line 1105 of file oxbase.php.

oxBase._getObjectViewName ( sTable,
sShopID = null 
) [protected]

Returns actual object view or table name

Parameters:
string $sTable Original table name
int $sShopID Shop ID
Returns:
string

Reimplemented in oxI18n.

Definition at line 995 of file oxbase.php.

oxBase._getTableFields ( sTable,
blReturnSimple = 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 $sTable table name
bool $blReturnSimple Set $blReturnSimple to true when you need simple array (meta data array is returned otherwise)
Returns:
array

Definition at line 1011 of file oxbase.php.

oxBase._getUpdateFields ( blUseSkipSaveFields = true  )  [protected]

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

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

Reimplemented in oxI18n.

Definition at line 1340 of file oxbase.php.

oxBase._getUpdateFieldValue ( sFieldName,
oField 
) [protected]

returns quoted field value for using in update statement

Parameters:
string $sFieldName name of field
oxField $oField field object
Returns:
string

Definition at line 1310 of file oxbase.php.

oxBase._initDataStructure ( blForceFullStructure = false  )  [protected]

Initilizes object data structure. Either by trying to load from cache or by calling $this->_getNonCachedFieldNames

Parameters:
bool $blForceFullStructure Set to true if you want to load full structure in any case.
Returns:
null;

Definition at line 1069 of file oxbase.php.

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

Reimplemented in oxGbEntry, oxI18n, oxNews, oxNewsSubscribed, oxOrder, oxPricealarm, oxRating, oxRemark, oxReview, oxUser, oxUserBasket, and oxUserPayment.

Definition at line 1406 of file oxbase.php.

oxBase._isDisabledFieldCache (  )  [protected]

Checks if current class disables field caching. This method is primary used in unit tests.

Returns:
bool

Definition at line 1500 of file oxbase.php.

oxBase._isInList (  )  [protected]

Checks if this instance is one of oxList elements.

Returns:
bool

Definition at line 982 of file oxbase.php.

oxBase._rebuildCache (  )  [protected]

Clears Smarty cache data.

Returns:
null

Definition at line 1444 of file oxbase.php.

oxBase._setFieldData ( sFieldName,
sValue,
iDataType = oxField::T_TEXT 
) [protected]

Sets data field value

Parameters:
string $sFieldName index OR name (eg. 'oxarticles__oxtitle') of a data field to set
string $sValue value of data field
int $iDataType field type
Returns:
null

Reimplemented in oxLinks, oxNews, oxNewsletter, oxStatistic, and oxUserBasketItem.

Definition at line 1230 of file oxbase.php.

oxBase._setRecordNumber ( sMaxField,
aWhere = null,
iMaxTryCnt = 5 
) [protected]

Tries to fetch and set next record number in DB. Returns true on success

Parameters:
string $sMaxField field name where record number is stored
string $aWhere where condition array
int $iMaxTryCnt max number of tryouts
Deprecated:
  • set from 2011.10.07 in version 4.6; in oxOrder class use _setNumber
Returns:
bool

Definition at line 1463 of file oxbase.php.

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

Exceptions:
oxObjectException Throws on failure inserting
Returns:
bool

Reimplemented in oxI18n, oxNews, oxNewsSubscribed, oxOrder, oxUser, and oxUserPayment.

Definition at line 1368 of file oxbase.php.

oxBase.addFieldName ( sName  ) 

Adds additional field name to meta structure

Parameters:
string $sName Field name
Returns:
null;

Definition at line 1563 of file oxbase.php.

oxBase.allowDerivedDelete (  ) 

Checks if derived delete is allowed (calls oxbase.isDerived)

Returns:
bool

Definition at line 798 of file oxbase.php.

oxBase.allowDerivedUpdate (  ) 

Checks if derived update is allowed (calls oxbase.isDerived)

Returns:
bool

Reimplemented in oxUser.

Definition at line 788 of file oxbase.php.

oxBase.assign ( dbRecord  ) 

Assigns DB field values to object fields. Returns true on success.

Parameters:
array $dbRecord Associative data values array
Returns:
null

Reimplemented in oxGbEntry, oxNews, oxOrder, oxReview, and oxWrapping.

Definition at line 393 of file oxbase.php.

oxBase.assignRecord ( sSelect  ) 

Performs SQL query, assigns record field values to object. Returns true on success.

Parameters:
string $sSelect SQL statement
Returns:
bool

Definition at line 653 of file oxbase.php.

oxBase.beforeUpdate ( sOXID = 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 $sOXID Object ID(default null). Pass the ID in case object is not loaded.
Returns:
null

Definition at line 888 of file oxbase.php.

oxBase.buildSelectString ( aWhere = null  ) 

Builds and returns SQL query string.

Parameters:
mixed $aWhere SQL select WHERE conditions array (default false)
Returns:
string

Definition at line 626 of file oxbase.php.

oxBase.delete ( sOXID = null  ) 

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

Parameters:
string $sOXID Object ID(default null)
Returns:
bool

Reimplemented in oxActions, oxAttribute, oxDelivery, oxDeliverySet, oxDiscount, oxFile, oxGroups, oxI18n, oxMediaUrl, oxNews, oxNewsletter, oxOrder, oxPayment, oxUser, oxUserBasket, and oxVoucherSerie.

Definition at line 708 of file oxbase.php.

oxBase.disableLazyLoading (  ) 

Disables lazy loading mechanism and inits object fully

Returns:
null;

Definition at line 542 of file oxbase.php.

oxBase.exists ( sOXID = null  ) 

Checks if this object exists, returns true on success.

Parameters:
string $sOXID Object ID(default null)
Returns:
bool

Reimplemented in oxUser.

Definition at line 810 of file oxbase.php.

oxBase.getClassName (  ) 

Returns object class name

Returns:
string

Definition at line 421 of file oxbase.php.

oxBase.getCoreTableName (  ) 

Return object core table name

Returns:
string

Definition at line 431 of file oxbase.php.

oxBase.getError ( sField  ) 

Returns error description of false if error field unavailable.

Parameters:
string $sField name of error
Deprecated:
since 20110823
Returns:
string

Definition at line 940 of file oxbase.php.

oxBase.getErrors (  ) 

Returns an errors array.

Deprecated:
since 20110823
Returns:
array

Definition at line 926 of file oxbase.php.

oxBase.getFieldData ( sFieldName  ) 

Gets field data

Parameters:
string $sFieldName name (eg. 'oxtitle') of a data field to get
Returns:
value of a data field

Definition at line 674 of file oxbase.php.

oxBase.getFieldNames (  ) 

Returns array with object field names

Returns:
array

Definition at line 1551 of file oxbase.php.

oxBase.getHtmlError ( sField  ) 

Returns errors if available.

Parameters:
string $sField name of error
Deprecated:
since 20110823
Returns:
array

Definition at line 960 of file oxbase.php.

oxBase.getId (  ) 

Returns unique object id.

Returns:
string

Definition at line 441 of file oxbase.php.

oxBase.getLanguage (  ) 

Returns -1, means object is not multilanguage

Returns:
int

Reimplemented in oxI18n.

Definition at line 1576 of file oxbase.php.

oxBase.getSelectFields ( blForceCoreTableUsage = null  ) 

Function builds the field list used in select.

Parameters:
bool $blForceCoreTableUsage (optional) use core views
Returns:
string

Definition at line 687 of file oxbase.php.

oxBase.getShopId (  ) 

Return original object shop id

Returns:
int

Definition at line 484 of file oxbase.php.

oxBase.getSqlActiveSnippet ( blForceCoreTable = null  ) 

Returns SQL select string with checks if items are available

Parameters:
bool $blForceCoreTable forces core table usage (optional)
Returns:
string

Definition at line 833 of file oxbase.php.

oxBase.getViewName ( blForceCoreTableUsage = null  ) 

Returns main table data is actually selected from (could be a view name as well)

Parameters:
bool $blForceCoreTableUsage (optional) use core views
Returns:
string

Definition at line 496 of file oxbase.php.

oxBase.hasErrors (  ) 

Returns number of errors.

Deprecated:
since 20110823
Returns:
integer

Definition at line 914 of file oxbase.php.

oxBase.init ( sTableName = null,
blForceAllFields = false 
)

Sets the names to main and view tables, loads metadata of each table.

Parameters:
string $sTableName Name of DB object table
bool $blForceAllFields Forces initialisation of all fields overriding lazy loading functionality
Returns:
null

Definition at line 366 of file oxbase.php.

oxBase.isDerived (  ) 

Returns true in case the item represented by this object is derived from parent shop

Returns:
bool

Definition at line 554 of file oxbase.php.

oxBase.isLoaded (  ) 

Returns object "loaded" state

Returns:
bool

Definition at line 614 of file oxbase.php.

oxBase.isMultilang (  ) 

Returns true, if object has multilanguage fields (if object is derived from oxi18n class). In oxBase it is always returns false, as oxBase treats all fields as non multilanguage.

Returns:
bool

Reimplemented in oxI18n.

Definition at line 578 of file oxbase.php.

oxBase.isOx (  ) 

Checks if object ID's first two chars are 'o' and 'x'. Returns true or false

Returns:
bool

Definition at line 1515 of file oxbase.php.

oxBase.isReadOnly (  ) 

Is object readonly

Returns:
bool

Definition at line 1529 of file oxbase.php.

oxBase.load ( sOXID  ) 

Loads object data from DB (object data ID is passed to method). Returns true on success. could throw oxObjectException F ?

Parameters:
string $sOXID Object ID
Returns:
bool

Reimplemented in oxNewsSubscribed, oxRemark, oxReview, oxUser, and oxUserPayment.

Definition at line 592 of file oxbase.php.

oxBase.modifyCacheKey ( sCacheKey,
blOverride = false 
)

Lazy loading cache key modifier.

Parameters:
string $sCacheKey kache key
bool $blOverride marker to force override cache key
Returns:
null;

Reimplemented in oxI18n.

Definition at line 528 of file oxbase.php.

oxBase.onChange ( iAction = null,
sOXID = 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 $iAction Action identifier.
string $sOXID Object ID(default null). Pass the ID in case object is not loaded.
Returns:
null

Definition at line 902 of file oxbase.php.

oxBase.oxClone ( oObject  ) 

Clone this object - similar to Copy Constructor.

Parameters:
object $oObject Object to copy
Returns:
null

Definition at line 346 of file oxbase.php.

oxBase.save (  ) 

Save this Object to database, insert or update as needed.

Returns:
mixed

Reimplemented in oxObject2Group, oxOrder, and oxUser.

Definition at line 740 of file oxbase.php.

oxBase.setId ( sOXID = null  ) 

Sets unique object id

Parameters:
string $sOXID Record ID
Returns:
string

Definition at line 453 of file oxbase.php.

oxBase.setInList (  ) 

Sets item as list element

Returns:
null

Definition at line 972 of file oxbase.php.

oxBase.setIsDerived ( blVal  ) 

Returns true in case the item represented by this object is derived from parent shop

Parameters:
bool $blVal if derived
Returns:
null

Definition at line 567 of file oxbase.php.

oxBase.setReadOnly ( blReadOnly  ) 

Set object readonly

Parameters:
bool $blReadOnly readonly flag
Returns:
null

Definition at line 1541 of file oxbase.php.

oxBase.setShopId ( iShopId  ) 

Sets original object shop ID

Parameters:
int $iShopId New shop ID
Returns:
null

Reimplemented in oxOrderFile.

Definition at line 474 of file oxbase.php.

oxBase.validate (  ) 

Checks if methods, stored in _aIdx2FldName array exists in running object methods collection. Returns true if method exists.

Deprecated:
since 20110823
Returns:
bool

Definition at line 863 of file oxbase.php.


Member Data Documentation

oxBase.$_aErrors = array() [protected]

Definition at line 44 of file oxbase.php.

oxBase.$_aFieldNames = array('oxid' => 0) [protected]

Definition at line 80 of file oxbase.php.

oxBase.$_aInnerLazyCache = null [protected]

Definition at line 167 of file oxbase.php.

oxBase.$_aSkipSaveFields = array() [protected]

Reimplemented in oxOrder, oxRemark, and oxUserBasket.

Definition at line 107 of file oxbase.php.

oxBase.$_blDisableFieldCaching = array() [static, protected]

Definition at line 132 of file oxbase.php.

oxBase.$_blEmployMultilanguage = false [protected]

Reimplemented in oxI18n.

Definition at line 174 of file oxbase.php.

oxBase.$_blIsDerived = null [protected]

Definition at line 121 of file oxbase.php.

oxBase.$_blIsInList = false [protected]

Definition at line 153 of file oxbase.php.

oxBase.$_blIsNewCache = false [protected]

Definition at line 86 of file oxbase.php.

oxBase.$_blIsSeoObject = false [protected]

Definition at line 139 of file oxbase.php.

oxBase.$_blIsSimplyClonable = true [protected]

Definition at line 35 of file oxbase.php.

oxBase.$_blReadOnly = false [protected]

Definition at line 146 of file oxbase.php.

oxBase.$_blUseLazyLoading = false [protected]

Definition at line 100 of file oxbase.php.

oxBase.$_iShopId = null [protected]

Definition at line 28 of file oxbase.php.

oxBase.$_isLoaded = false [protected]

Definition at line 160 of file oxbase.php.

oxBase.$_sCacheKey = null [protected]

Definition at line 93 of file oxbase.php.

oxBase.$_sClassName = 'oxbase' [protected]
oxBase.$_sCoreTable = null [protected]

Reimplemented in oxFile, and oxOrderFile.

Definition at line 57 of file oxbase.php.

oxBase.$_sCoreTbl = null [protected]

Definition at line 66 of file oxbase.php.

oxBase.$_sExistKey = "oxid" [protected]

Definition at line 113 of file oxbase.php.

oxBase.$_sOXID = null [protected]

Definition at line 22 of file oxbase.php.

oxBase.$_sViewTable = null [protected]

Definition at line 72 of file oxbase.php.


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