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

/**
 * Class TB_Shared_Ent_TeamData_AdminNote
 *
 * @property integer $id
 * @property integer $group_id
 * @property integer $profile_id
 * @property integer $creator_profile_id
 * @property string $note
 * @property DateTime $last_updated_dt
 * @property DateTime $created_dt
 */
class TB_Shared_Ent_TeamData_AdminNote extends Francis_Db_Row
{
    /**
     * @param $teamId
     * @param $profileId
     * @return NULL|TB_Shared_Ent_TeamData_AdminNote
     */
    public static function getByGroupIdAndProfileId( $teamId, $profileId )
    {
        $sql  = 'SELECT * FROM ' . self::getTable() . ' WHERE ';
        $sql .= 'group_id = :group_id AND ';
        $sql .= 'profile_id = :profile_id LIMIT 1';

        $params = array( ':group_id' => $teamId, ':profile_id' => $profileId );
        return self::findOne( $sql, $params );
    }

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

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