private function translateQuery($sql) {
        // model name pattern: ":User" => "t_user" (will also convert matching names in literals and comments)
        $pattern = '/[^:]:([a-z_]\w*)\b/i';
        if (preg_match_all($pattern, $sql, $matches, PREG_OFFSET_CAPTURE)) {
            $namespace = strLeftTo($this->entityClass, '\\', -1, true, '');

            foreach (\array_reverse($matches[1]) as $match) {
                $modelName = $match[0];
                $offset    = $match[1];
                $className = $namespace.$modelName;
                if (is_a($className, PersistableObject::class, true)) {
                    /** @var DAO $dao */
                    $dao   = $className::dao();
                    $table = $dao->getMapping()['table'];
                    $sql   = substr_replace($sql, $table, $offset-1, strlen($modelName)+1);
                }
            }
        }
        return $sql;
    }