Skip to content

Commit

Permalink
updated getHandler
Browse files Browse the repository at this point in the history
  • Loading branch information
mambax7 committed Oct 21, 2019
1 parent 3c5188b commit 89a4a65
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion class/Helper.php
Expand Up @@ -73,8 +73,15 @@ public function getDirname()
public function getHandler($name)
{
$ret = false;
$db = \XoopsDatabaseFactory::getDatabaseConnection();
$class = __NAMESPACE__ . '\\' . ucfirst($name) . 'Handler';
if (!class_exists($class)) {
throw new \RuntimeException("Class '$class' not found");
}
/** @var \XoopsMySQLDatabase $db */
$db = \XoopsDatabaseFactory::getDatabaseConnection();
$helper = self::getInstance();
$ret = new $class($db, $helper);
$this->addLog("Getting handler '{$name}'");
return new $class($db);
}
}

0 comments on commit 89a4a65

Please sign in to comment.