<?php

/**
 * Class TB_Shared_Ent_TeamData_KKSpecialProfileAttributes
 *
 * @property int $id
 * @property int $profile_id
 * @property int $team_id
 * @property array $attributes_js
 * @property DateTime $last_updated_dt
 * @property DateTime $created_dt
 */
class TB_Shared_Ent_TeamData_KKSpecialEmployee extends Francis_Db_Row
{

    public static function getByTeamIdAndProfileId( $teamId, $profileId )
    {
        $sql = 'SELECT * FROM ' . self::getTable() . ' WHERE ';
        $sql .= 'team_id = :team_id AND profile_id = :profile_id LIMIT 1 ';

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

    /**
     * @param $teamId
     * @return array
     */
    public static function getByTeamId( $teamId )
    {
        $sql = 'SELECT * FROM ' . self::getTable() . ' WHERE ';
        $sql .= 'team_id = :team_id ';

        $params = array( ':team_id' => $teamId );
        return self::findMany( $sql, $params );
    }

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

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