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