本文整理汇总了PHP中oxBase类的典型用法代码示例。如果您正苦于以下问题:PHP oxBase类的具体用法?PHP oxBase怎么用?PHP oxBase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了oxBase类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: validateFields
/**
* Checks if all required fields are filled.
* Returns array of invalid fields or empty array if all fields are fine.
*
* @param oxBase $oObject Address fields with values.
*
* @return bool If any invalid field exist.
*/
public function validateFields($oObject)
{
$aRequiredFields = $this->getRequiredFields();
$oFieldValidator = $this->getFieldValidator();
$aInvalidFields = array();
foreach ($aRequiredFields as $sFieldName) {
if (!$oFieldValidator->validateFieldValue($oObject->getFieldData($sFieldName))) {
$aInvalidFields[] = $sFieldName;
}
}
$this->_setInvalidFields($aInvalidFields);
return empty($aInvalidFields);
}
示例2: __construct
/**
* Class constructor, initiates parent constructor (parent::oxBase()) and sets table name.
*/
public function __construct()
{
parent::__construct();
$this->init('oxobject2category');
}
示例3: _postSaveObject
/**
* post saving hook. can finish transactions if needed or ajust related data
*
* @param oxBase $oShopObject shop object
* @param data $aData data to save
*
* @return mixed data to return
*/
protected function _postSaveObject($oShopObject, $aData)
{
$sOXID = $oShopObject->getId();
$oShopObject->onChange(null, $sOXID, $sOXID);
// returning ID on success
return $sOXID;
}
示例4: _setFieldData
/**
* Sets data field value
*
* @param string $sFieldName index OR name (eg. 'oxarticles__oxtitle') of a data field to set
* @param string $sValue value of data field
* @param int $iDataType field type
*
* @return null
*/
protected function _setFieldData($sFieldName, $sValue, $iDataType = oxField::T_TEXT)
{
if ('oxvalue' === $sFieldName) {
$iDataType = oxField::T_RAW;
}
return parent::_setFieldData($sFieldName, $sValue, $iDataType);
}
示例5: _insert
/**
* Inserts object data fields in DB. Returns true on success.
*
* @return bool
*/
protected function _insert()
{
// set oxcreate
$sNow = date('Y-m-d H:i:s', oxRegistry::get("oxUtilsDate")->getTime());
$this->oxremark__oxcreate = new oxField($sNow, oxField::T_RAW);
$this->oxremark__oxheader = new oxField($sNow, oxField::T_RAW);
return parent::_insert();
}
示例6: save
/**
* Extends the default save method.
* Saves only if this kind of entry do not exists.
*
* @return bool
*/
public function save()
{
$oDb = oxDb::getDb();
$sQ = "select 1 from oxobject2group where oxgroupsid = " . $oDb->quote($this->oxobject2group__oxgroupsid->value);
$sQ .= " and oxobjectid = " . $oDb->quote($this->oxobject2group__oxobjectid->value);
// does not exist
if (!$oDb->getOne($sQ, false, false)) {
return parent::save();
}
}
示例7: delete
/**
* Override delete function so we can delete user group and article or category relations first.
*
* @param string $sOxId object ID (default null)
*
* @return null
*/
public function delete($sOxId = null)
{
if (!$sOxId) {
$sOxId = $this->getId();
}
$this->unsetDiscountRelations();
$this->unsetUserGroups();
$this->deleteVoucherList();
return parent::delete($sOxId);
}
示例8: save
/**
* Extends the default save method.
* Saves only if this kind of entry do not exists.
*
* @throws DatabaseException
*
* @return bool
*/
public function save()
{
try {
return parent::save();
} catch (\OxidEsales\EshopCommunity\Core\Exception\DatabaseException $exception) {
/**
* The table oxobject2group has an UNIQUE index on (OXGROUPSID, OXOBJECTID, OXSHOPID)
* If there is a DatabaseException and the exception code is 1062 i.e. "Duplicate entry",
* the exception will be discarded and the record will not be inserted.
*/
if ($exception->getCode() != '1062') {
throw $exception;
}
}
}
示例9: __construct
/**
* Class constructor
*
* @return null
*/
public function __construct()
{
parent::__construct();
$this->init('oxaddress');
}
示例10: save
/**
* Save this Object to database, insert or update as needed.
*
* @return mixed
*/
public function save()
{
if (!$this->oxrecommlists__oxtitle->value) {
throw oxNew("oxObjectException", 'EXCEPTION_RECOMMLIST_NOTITLE');
}
return parent::save();
}
示例11: delete
/**
* Deletes oxFile record from DB, removes orphan files.
*
* @param string $sOxId default null
*
* @return bool
*/
public function delete($sOxId = null)
{
$sOxId = $sOxId ? $sOxId : $this->getId();
$this->load($sOxId);
// if record cannot be delete, abort deletion
if ($blDeleted = parent::delete($sOxId)) {
$this->_deleteFile();
}
return $blDeleted;
}
示例12: _update
/**
* Updates payment record in DB. Returns update status.
*
* @return bool
*/
protected function _update()
{
$oDb = oxDb::getDb();
//encode sensitive data
if ($sValue = $this->oxuserpayments__oxvalue->value) {
$sEncodedValue = $oDb->getOne("select encode( " . $oDb->quote($sValue) . ", '" . $this->getPaymentKey() . "' )", false, false);
$this->oxuserpayments__oxvalue->setValue($sEncodedValue);
}
$blRet = parent::_update();
//restore, as encoding was needed only for saving
if ($sEncodedValue) {
$this->oxuserpayments__oxvalue->setValue($sValue);
}
return $blRet;
}
示例13: _insert
/**
* Sets article creation date
* (oxorderarticle::oxorderarticles__oxtimestamp). Then executes parent method
* parent::_insert() and returns insertion status.
*
* @return bool
*/
protected function _insert()
{
$iInsertTime = time();
$now = date('Y-m-d H:i:s', $iInsertTime);
$this->oxorderarticles__oxtimestamp = new oxField($now);
return parent::_insert();
}
示例14: _update
/**
* We need to check if we unsubscribe here
*
* @return mixed oxid on success or false on failure
*/
protected function _update()
{
if (($this->_blWasSubscribed || $this->_blWasPreSubscribed) && !$this->oxnewssubscribed__oxdboptin->value) {
// set unsubscription date
$this->oxnewssubscribed__oxunsubscribed->setValue(date('Y-m-d H:i:s'));
// 0001974 Same object can be called many times without requiring to renew date.
// If so happens, it would have _aSkipSaveFields set to skip date field. So need to check and
// release if _aSkipSaveFields are set for field oxunsubscribed.
$aSkipSaveFieldsKeys = array_keys($this->_aSkipSaveFields, 'oxunsubscribed');
foreach ($aSkipSaveFieldsKeys as $iSkipSaveFieldKey) {
unset($this->_aSkipSaveFields[$iSkipSaveFieldKey]);
}
} else {
// don't update date
$this->_aSkipSaveFields[] = 'oxunsubscribed';
}
return parent::_update();
}
示例15: _getFieldLongName
/**
* returns long name
*
* @param string $sFieldName - field name
*
* @return string
*/
protected function _getFieldLongName($sFieldName)
{
$aFieldNames = array('oxorderfiles__oxarticletitle', 'oxorderfiles__oxarticleartnum', 'oxorderfiles__oxordernr', 'oxorderfiles__oxorderdate', 'oxorderfiles__oxispaid', 'oxorderfiles__oxpurchasedonly');
if (in_array($sFieldName, $aFieldNames)) {
return $sFieldName;
}
return parent::_getFieldLongName($sFieldName);
}