本文整理匯總了PHP中xPDOObject::load方法的典型用法代碼示例。如果您正苦於以下問題:PHP xPDOObject::load方法的具體用法?PHP xPDOObject::load怎麽用?PHP xPDOObject::load使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類xPDOObject
的用法示例。
在下文中一共展示了xPDOObject::load方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: load
/**
* Custom instance loader that forces access policy checking.
*
* {@inheritdoc}
*/
public static function load(xPDO &$xpdo, $className, $criteria, $cacheFlag = true)
{
$object = null;
$object = xPDOObject::load($xpdo, $className, $criteria, $cacheFlag);
if ($object && !$object->checkPolicy('load')) {
$userid = $xpdo->getLoginUserID();
if (!$userid) {
$userid = '0';
}
$xpdo->log(xPDO::LOG_LEVEL_INFO, "Principal {$userid} does not have access to requested object of class {$object->_class} with primary key " . print_r($object->getPrimaryKey(false), true));
$object = null;
}
return $object;
}
示例2: load
public static function load(xPDO &$xpdo, $className, $criteria, $cacheFlag = true)
{
$instance = parent::load($xpdo, 'up2Profile', $criteria, $cacheFlag);
if (!is_object($instance) || !$instance instanceof $className) {
if (is_numeric($criteria) || is_array($criteria) && !empty($criteria['id'])) {
$id = is_numeric($criteria) ? $criteria : $criteria['id'];
if ($xpdo->getCount('modUser', array('id' => $id))) {
$instance = $xpdo->newObject('up2Profile');
$instance->set('id', $id);
$instance->save();
}
}
}
return $instance;
}
示例3: load
public static function load(xPDO &$xpdo, $className, $criteria, $cacheFlag = true)
{
/* @var $instance msCustomerProfile */
$instance = parent::load($xpdo, 'msCustomerProfile', $criteria, $cacheFlag);
if (!is_object($instance) || !$instance instanceof $className) {
if (is_numeric($criteria) || is_array($criteria) && !empty($criteria['id'])) {
$id = is_numeric($criteria) ? $criteria : $criteria['id'];
if ($xpdo->getCount('modUser', array('id' => $id))) {
$instance = $xpdo->newObject('msCustomerProfile');
$time = time();
$instance->set('id', $id);
$instance->fromArray(array('createdon' => $time, 'referrer_code' => md5($id . $time)));
$instance->save();
}
}
}
return $instance;
}