$modx -> resource -> setTVValue(11, 1);
print_r($modx -> resource -> getTVValue(11));
$modx -> resource -> setTVValue(11, 2);
print_r($modx -> resource -> getTVValue(11));
I have a snippet that outputs 2 and 2, whereas it should output 1 and 2. Resource caching is turned off; snippet call is not cached either.
I have tried to fix this problem by another way, but it still updates my TV only after the whole page gets reloaded:
$tv = $modx->getObject('modTemplateVar',array('id'=>'11'));
$tv -> setValue($modx->resource->get('id'), 88);
$tv->save();
print_r($modx -> resource -> getTVValue(11));
By the way, if I am not working with TVs, everything is fine!
$modx -> resource -> set("pagetitle", 1);
print_r($modx -> resource -> get("pagetitle"));
$modx -> resource -> set("pagetitle", 2);
print_r($modx -> resource -> get("pagetitle"));
How do I fix this issue with TVs? I've tried to clear cache like this $modx->cacheManager->refresh();
too, but it didn't do the trick.