On a new upgrade to MODx 3.0.4 from MODx 2.8.6, running PHP 8.1, I have many repeat errors in the log saying:
.../core/vendor/xpdo/xpdo/src/xPDO/xPDO.php : 667) Could not load class: TaggerTag from mysql.taggertag
Any idea what could be causing this?
Tagger 2.0.0-pl is installed and seems to be working.
This looks like somewhere the class “TaggerTag” gets used without the namespace (Tagger\Model\TaggerTag
).
Maybe you have some custom code (e.g. in a snippet) that uses “TaggerTag” and has not yet been adapted to MODX 3.
The only custom snippet is one you actually helped me figure out and troubleshoot here:
I thought I had it upgraded.
Final code ended up being like this:
<?php
$tagger = null;
try {
if ($modx->services->has('tagger')) {
$tagger = $modx->services->get('tagger');
}
} catch (ContainerExceptionInterface $e) {
return '';
}
if (!($tagger instanceof Tagger\Tagger)) return '';
$group_ids = array(1,2,3,4,5); //The groups to include in the filtering
$all_checked_tags = array();
$where = array();
foreach($group_ids as $group_id){
if (isset($_GET['filter'.$group_id])) {
$tag_ids = $_GET['filter'.$group_id];
if (is_array($tag_ids)){
$tag_ids = array_map('intval', $tag_ids);
$where[] = "EXISTS (SELECT 1 FROM {$modx->getTableName('Tagger\\Model\\TaggerTagResource')} r WHERE r.tag IN (" . implode(',',$tag_ids) . ") AND r.resource = modResource.id)";
$all_checked_tags = array_merge($all_checked_tags,$tag_ids);
}
}
}
$search_value = '';
if (isset($_GET['search'])) {
$search_value = filter_var($_GET['search'], FILTER_SANITIZE_STRING);
$min_length_search_value = 3;
if (mb_strlen($search_value) >= $min_length_search_value){
$search_value_wildcards = "%" . $search_value . "%";
$where[] = array("pagetitle:LIKE" => $search_value_wildcards, "OR:b_title:LIKE" => $search_value_wildcards, "OR:b_subtitle:LIKE" => $search_value_wildcards, "OR:b_description:LIKE" => $search_value_wildcards, "OR:b_author:LIKE" => $search_value_wildcards, "OR:b_code:LIKE" => $search_value_wildcards);
}
}
$modx->setPlaceholder('search_value', $search_value);
//This placeholder is used to preserve the "checked"-state of the checkboxes
$modx->setPlaceholder('filter_tag_ids',$modx->toJson($all_checked_tags));
//This placeholder is used for the getResources subquery
$modx->setPlaceholder('filter_subquery',$modx->toJSON($where));
return '';
This snippet doesn’t use the class “TaggerTag”. So it’s unlikely to cause the error message in the log.