本文整理汇总了PHP中oxBase::save方法的典型用法代码示例。如果您正苦于以下问题:PHP oxBase::save方法的具体用法?PHP oxBase::save怎么用?PHP oxBase::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类oxBase
的用法示例。
在下文中一共展示了oxBase::save方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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();
}
}
示例2: 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;
}
}
}
示例3: save
/**
* Saves order article object. If saving succeded - updates
* article stock information if oxOrderArticle::isNewOrderItem()
* returns TRUE. Returns saving status
*
* @return bool
*/
public function save()
{
// ordered articles
if (($blSave = parent::save()) && $this->isNewOrderItem()) {
$myConfig = $this->getConfig();
if ($myConfig->getConfigParam('blUseStock') && $myConfig->getConfigParam('blPsBasketReservationEnabled')) {
$this->getSession()->getBasketReservations()->commitArticleReservation($this->oxorderarticles__oxartid->value, $this->oxorderarticles__oxamount->value);
} else {
$this->updateArticleStock($this->oxorderarticles__oxamount->value * -1, $myConfig->getConfigParam('blAllowNegativeStock'));
}
// seting downloadable products article files
$this->_setOrderFiles();
// marking object as "non new" disable further stock changes
$this->setIsNewOrderItem(false);
}
return $blSave;
}
示例4: 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();
}
示例5: createObj2Obj
/**
* Create object 2 object connection in databse
*
* @param array $aData db fields and values
* @param string $sObj2ObjTable table name
*/
public function createObj2Obj($aData, $sObj2ObjTable)
{
if (empty($aData)) {
return;
}
$iCnt = count($aData);
for ($i = 0; $i < $iCnt; $i++) {
$oObj = new oxBase();
$oObj->init($sObj2ObjTable);
if ($iCnt < 2) {
$aObj = $aData[$i];
} else {
$aObj = $aData;
}
foreach ($aObj as $sKey => $sValue) {
$sField = $sObj2ObjTable . "__" . $sKey;
$oObj->{$sField} = new oxField($sValue, oxField::T_RAW);
}
$oObj->save();
}
}
示例6: save
/**
* Saves (updates) user object data information in DB. Return true on success.
*
* @return bool
*/
public function save()
{
$myConfig = oxRegistry::getConfig();
$blAddRemark = false;
if ($this->oxuser__oxpassword->value && $this->oxuser__oxregister->value < 1) {
$blAddRemark = true;
//save oxregister value
$this->oxuser__oxregister = new oxField(date('Y-m-d H:i:s'), oxField::T_RAW);
}
// setting user rights
$this->oxuser__oxrights = new oxField($this->_getUserRights(), oxField::T_RAW);
// processing birth date which came from output as array
if (is_array($this->oxuser__oxbirthdate->value)) {
$this->oxuser__oxbirthdate = new oxField($this->convertBirthday($this->oxuser__oxbirthdate->value), oxField::T_RAW);
}
$blRet = parent::save();
//add registered remark
if ($blAddRemark && $blRet) {
$oRemark = oxNew('oxremark');
$oRemark->oxremark__oxtext = new oxField(oxRegistry::getLang()->translateString('usrRegistered', null, true), oxField::T_RAW);
$oRemark->oxremark__oxtype = new oxField('r', oxField::T_RAW);
$oRemark->oxremark__oxparentid = new oxField($this->getId(), oxField::T_RAW);
$oRemark->save();
}
return $blRet;
}
示例7: save
/**
* Saves (updates) user object data information in DB. Return true on success.
*
* @return bool
*/
public function save()
{
$myConfig = oxConfig::getInstance();
$blAddRemark = false;
if ($this->oxuser__oxpassword->value && $this->oxuser__oxregister->value < 1) {
$blAddRemark = true;
//save oxregister value
$this->oxuser__oxregister = new oxField(date('Y-m-d H:i:s'), oxField::T_RAW);
}
// setting user rights
$this->oxuser__oxrights = new oxField($this->_getUserRights(), oxField::T_RAW);
// processing birth date which came from output as array
if (is_array($this->oxuser__oxbirthdate->value)) {
$this->oxuser__oxbirthdate = new oxField($this->convertBirthday($this->oxuser__oxbirthdate->value), oxField::T_RAW);
}
// checking if user Facebook ID should be updated
if ($myConfig->getConfigParam("bl_showFbConnect")) {
$oFb = oxFb::getInstance();
if ($oFb->isConnected() && $oFb->getUser()) {
$this->oxuser__oxfbid = new oxField($oFb->getUser());
}
}
$blRet = parent::save();
//add registered remark
if ($blAddRemark && $blRet) {
$oRemark = oxNew('oxremark');
$oRemark->oxremark__oxtext = new oxField(oxLang::getInstance()->translateString('usrRegistered'), oxField::T_RAW);
$oRemark->oxremark__oxtype = new oxField('r', oxField::T_RAW);
$oRemark->oxremark__oxparentid = new oxField($this->getId(), oxField::T_RAW);
$oRemark->save();
}
return $blRet;
}
示例8: save
/**
* Updates/inserts order object and related info to DB
*
* @return null
*/
public function save()
{
if ($blSave = parent::save()) {
// saving order articles
$oOrderArticles = $this->getOrderArticles();
if ($oOrderArticles && count($oOrderArticles) > 0) {
foreach ($oOrderArticles as $oOrderArticle) {
$oOrderArticle->save();
}
}
}
return $blSave;
}