Yes. I knew your intention for adding a fake var (category_name) to article object.
But i dont think it is good for you because:
1- As i said before it will not help you to reduce query.
2- You should
overwrite all functions in the parent object (XoopsPersistableObjectHandler) to avoid issues.
for example assume you want to store those objects like this:
$articles = $article_handler->getObjects( $criteria );
foreach ($articles as $art) {
if(!empty($_POST["article_title"]) $art->setVar('title', $_POST["article_title"]);
// echo $art->getVar('category_name');
$article_handler->insert($art, true); // error because category_name is not exist.
}
so you have to write insert function too.
then you have to write many other functions. It would not be good for you !!!
based on my experiences using fake vars in a class is
only good and acceptable if those tables stick together very tightly and developer dont need to write a handler for one of them.
for example in newbb there is bb_posts and bb_posts_text but there is only one handler NewbbPostHandler extends ArtObjectHandler
Then developer overwritten all needed functions like get, insert, ... by using JOIN.
So in newbb developer dont write any handler for posts text.
side note: it is better to use getAll instead of getObjects because getObjects will be deprecated in next versions.
If you really want to reduce query for category_name the best way is creating a cache file and store all $catNames[$cat_id] = "category_name";
then you have them available any time without any query.