Hi, I’m having troubles accessing imported resources. We pull in articles via an API and import them into Modx by using $doc = $modx->newObject('modDocument');
We set all properties like this
$doc->set(‘parent’,$this->parent);
$doc->set(‘pagetitle’,$item->title);
$doc->set(‘longtitle’,$item->title);
$doc->set(‘alias’,$item->seoName);
$doc->set(‘template’,$this->template);
$doc->set(‘pub_date’,$item->publishedFrom);
$doc->setContent($item->body);
and create the alias and URI:
$parentResourceTitle = $modx->getObject(‘modResource’,$this->parent)->get(‘pagetitle’);
$parentAlias = $doc->cleanAlias($parentResourceTitle);
$alias = $doc->get('alias'); // get the generated alias
$doc->set('uri', $parentAlias.'/'.$alias.'.html');
$doc->save();
Evertying works, the resources are available in the backend. All fields filled correct, but the articles are not available using their URL. Until… we clear the cache manually or we hit Refresh URIs via the backend. Since articles are added every x-minutes. We need the articles/urls to be available without manually clearling cache/refresh URIs.
Already tried this; killed my site completely. Invalidated the complete cache making front- and backend unavailable until clearing the cache folder manually.
And… since we import articles every 5 minutes, we would be clearing the cache each 5 minutes. This would/could mean a big performance lag.
Bob, thanks for your reply. No luck so far. Since I’m able to create the alias and URI, we just reference these instead of [[~[[+id]]]] - which seems to cause the issue.