<?php
/********************************************************************************
 * (c)1337 aheadware.com - All rights reserved
 ********************************************************************************/


/**
 * Class TB_Shared_Ent_TeamData_CourseTemplates
 *
 * @property int $id
 * @property int $team_id
 * @property string $category_id
 * @property string $subject
 * @property int $duration
 * @property int $deadline_before
 * @property string|null $location
 * @property string|null $comment
 * @property DateTime $last_updated_dt
 * @property DateTime $created_dt
 */
class TB_Shared_Ent_TeamData_CourseTemplates extends Francis_Db_Row
{
    /**
     * @param $teamId
     * @return NULL|TB_Shared_Ent_TeamData_CourseCategories[]
     */
    public static function getByTeamId( $teamId )
    {
        $sql = 'SELECT * FROM ' . self::getTable() . ' WHERE team_id = :team_id';
        return self::findMany( $sql, array( ':team_id' => $teamId ) );
    }

    /**
     * Return table name
     *
     * @return null|string
     */
    public static function getTable()
    {
        return 'course_categories';
    }

    /**
     * Return db handler
     *
     * @return Francis_Db_MySql|null
     */
    public static function getDbh()
    {
        return TB_Shared_Db_TeamData::get();
    }
}