Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is cacheManager->generateResource work correct? It does not cache TVs... #14718

iWatchYouFromAfar opened this issue Sep 5, 2019 · 1 comment


Copy link

commented Sep 5, 2019


I'm trying to create a resource cache through a script, for this I use:

Step to reproduce

Just execute this simple code:

$q = $modx->newQuery('modResource');
    'published' => true,
    'deleted' => false,
    'cacheable' => true,
    'searchable' => true,
    'class_key' => 'modDocument',
$resources = $modx->getCollection('modResource', $q);
foreach ($resources as $page) {
    $page->_contextKey = $page->get('context_key');

Observed behavior

You get a resources cache without TVs.

Expected behavior

I expect to get a full cached resource with TVs.


MODX 2.7.1
PHP 7.2

@iWatchYouFromAfar iWatchYouFromAfar changed the title Is cacheManager->generateResource work correct? Is cacheManager->generateResource work correct? It does not cache TVs... Sep 5, 2019


This comment has been minimized.

Copy link

commented Sep 6, 2019

I don't think that method was meant to be used outside of the regular resource rendering flow. It relies on the in-memory element and source cache, as well as registered scripts, so is not a completely self-contained way of generating the resource cache.

While that means the bug report is technically correct, calling it like you're doing now results in an incomplete cache, I don't think it's something we necessarily have to fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.