本文整理匯總了PHP中CustomFieldData::setNotModified方法的典型用法代碼示例。如果您正苦於以下問題:PHP CustomFieldData::setNotModified方法的具體用法?PHP CustomFieldData::setNotModified怎麽用?PHP CustomFieldData::setNotModified使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CustomFieldData
的用法示例。
在下文中一共展示了CustomFieldData::setNotModified方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getByName
/**
* Given a name, get the custom field data model. Attempts to retrieve from cache, if it is not available,
* will attempt to retrieve from persistent storage, cache the model, and return.
* @param string $name
* @return CustomFieldData model
* @throws NotFoundException
*/
public static function getByName($name, $shouldCache = true)
{
if (isset(self::$cachedModelsByName[$name])) {
return self::$cachedModelsByName[$name];
}
try {
// not using default value to save cpu cycles on requests that follow the first exception.
return GeneralCache::getEntry('CustomFieldData' . $name);
} catch (NotFoundException $e) {
assert('is_string($name)');
assert('$name != ""');
$bean = ZurmoRedBean::findOne('customfielddata', "name = :name ", array(':name' => $name));
assert('$bean === false || $bean instanceof RedBean_OODBBean');
if ($bean === false) {
$customFieldData = new CustomFieldData();
$customFieldData->name = $name;
$customFieldData->serializedData = serialize(array());
// An unused custom field data does not present as needing saving.
$customFieldData->setNotModified();
} else {
$customFieldData = self::makeModel($bean);
}
if ($shouldCache) {
self::$cachedModelsByName[$name] = $customFieldData;
GeneralCache::cacheEntry('CustomFieldData' . $name, $customFieldData);
}
return $customFieldData;
}
}
示例2: getByName
/**
* Given a name, get the custom field data model. Attempts to retrieve from cache, if it is not available,
* will attempt to retrieve from persistent storage, cache the model, and return.
* @param string $name
*/
public static function getByName($name)
{
try {
return GeneralCache::getEntry('CustomFieldData' . $name);
} catch (NotFoundException $e) {
assert('is_string($name)');
assert('$name != ""');
$bean = R::findOne('customfielddata', "name = '{$name}'");
assert('$bean === false || $bean instanceof RedBean_OODBBean');
if ($bean === false) {
$customFieldData = new CustomFieldData();
$customFieldData->name = $name;
$customFieldData->serializedData = serialize(array());
// An unused custom field data does not present as needing saving.
$customFieldData->setNotModified();
return $customFieldData;
}
$model = self::makeModel($bean);
GeneralCache::cacheEntry('CustomFieldData' . $name, $model);
return $model;
}
}