本文整理匯總了PHP中oxBase::exists方法的典型用法代碼示例。如果您正苦於以下問題:PHP oxBase::exists方法的具體用法?PHP oxBase::exists怎麽用?PHP oxBase::exists使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類oxBase
的用法示例。
在下文中一共展示了oxBase::exists方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: _preAssignObject
/**
* issued before saving an object. can modify aData for saving
*
* @param oxBase $oShopObject shop object
* @param array $aData data to prepare
* @param bool $blAllowCustomShopId if allow custom shop id
*
* @return array
*/
protected function _preAssignObject($oShopObject, $aData, $blAllowCustomShopId)
{
if (!isset($aData['OXSTOCKFLAG'])) {
if (!$aData['OXID'] || !$oShopObject->exists($aData['OXID'])) {
// default value is 1 according to eShop admin functionality
$aData['OXSTOCKFLAG'] = 1;
}
}
$aData = parent::_preAssignObject($oShopObject, $aData, $blAllowCustomShopId);
return $aData;
}
示例2: exists
/**
* Checks if user exists in database.
*
* @param string $sOXID object ID (default null)
*
* @return bool
*/
public function exists($sOXID = null)
{
if (!$sOXID) {
$sOXID = $this->getId();
}
//#5901 if physical record exists return true unconditionally
if (parent::exists($sOXID)) {
$this->setId($sOXID);
return true;
}
//additional username check
//This part is used by not yet saved user object, to detect the case when such username exists in db.
//Basically it is called when anonymous visitor enters existing username for newsletter subscription
//see Newsletter::send()
//TODO: transfer this validation to newsletter part
$sShopSelect = '';
if (!$this->_blMallUsers && $this->oxuser__oxrights->value != 'malladmin') {
$sShopSelect = ' AND oxshopid = "' . $this->getConfig()->getShopId() . '" ';
}
// We force reading from master to prevent issues with slow replications or open transactions (see ESDEV-3804).
$masterDb = oxDb::getMaster();
$sSelect = 'SELECT oxid FROM ' . $this->getViewName() . '
WHERE ( oxusername = ' . $masterDb->quote($this->oxuser__oxusername->value) . ' ) ';
$sSelect .= $sShopSelect;
if ($sOxid = $masterDb->getOne($sSelect)) {
// update - set oxid
$this->setId($sOxid);
return true;
}
return false;
}