public static function findByPk($pk, $condition = null)
    {
        if (!is_a($condition, '\\mpf\\datasources\\sql\\ModelCondition'))
            $condition = ModelCondition::getFrom($condition, get_called_class());

        /* @var $condition \mpf\datasources\sql\ModelCondition */
        $oldLimit = $condition->limit;
        $condition->limit = 1;
        $models = static::findAllByPk($pk, $condition);
        $condition->limit = $oldLimit;
        return isset($models[0]) ? $models[0] : null;
    }
public static function findByPk($pk, $condition = null)
    {
        if (!is_a($condition, '\\mpf\\datasources\\sql\\ModelCondition'))
            $condition = ModelCondition::getFrom($condition, get_called_class());

        /* @var $condition \mpf\datasources\sql\ModelCondition */
        $oldLimit = $condition->limit;
        $condition->limit = 1;
        $models = static::findAllByPk($pk, $condition);
        $condition->limit = $oldLimit;
        return isset($models[0]) ? $models[0] : null;
    }
public static function findByPk ( $ pk , $ condition = null ) { if ( ! is_a ( $ condition , '\\mpf\\datasources\\sql\\ModelCondition' ) ) $ condition = ModelCondition :: getFrom ( $ condition , get_called_class ( ) ) ; /* @var $condition \mpf\datasources\sql\ModelCondition */ $ oldLimit = $ condition -> limit ; $ condition -> limit = 1 ; $ models = static :: findAllByPk ( $ pk , $ condition ) ; $ condition -> limit = $ oldLimit ; return isset ( $ models [ 0 ] ) ? $ models [ 0 ] : null ; }
Return single row model;
@param int $pk
@param mixed $condition
@return static
Return single row model ;