本文整理汇总了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;
}