Back to PhocaDownloadCategory class

Method getCategoryByFile

public static
getCategoryByFile
(mixed $id = 0)

Method getCategoryByFile - Source code

public static function getCategoryByFile($id = 0)
{
    $db = Factory::getDBO();
    $query = 'SELECT c.id, c.title, c.alias' . ' FROM #__phocadownload_categories AS c' . ' LEFT JOIN #__phocadownload AS a ON a.catid = c.id' . ' WHERE a.id =' . (int) $id . ' ORDER BY c.id' . ' LIMIT 1';
    $db->setQuery($query);
    $item = $db->loadObject();
    return $item;
}