Open wshawn opened 12 years ago
wshawn submitted:
The snippet is being called uncached.
okyanet submitted:
Looks like this issue is still affecting 2.2: http://forums.modx.com/thread/?thread=73758&page=1
gadgetto submitted:
Still same problem here (MODx Revo 2.2.4-pl):
and:
Method getTVValue
returns value from resource cache (if exists). This is expected behavior. Also as method get
returns field of resource, saved in cache (if exists).
For getting data from database use xPDO:
// value from cache
$myValue = $modx->resource->getTVValue('myTV');
// request to database
$tvValue = $modx->getObject('modTemplateVarResource', [
'tmplvarid' => 3, 'contentid' => $modx->resource->id
]);
if ($tvValue) {
$myValue = $tvValue->value;
}
// saving
$myValue++;
$modx->resource->setTVValue('myTV', $myValue);
wshawn created Redmine issue ID 5294
If the Resource itself is cached, this function never seems to fire.
Implementation: