public function getBy(array $condition) : User
    {
        if (!$user = User::find()->andWhere($condition)->limit(1)->one()) {
            throw new NotFoundException($this->i18n->t('setrun/user', 'User not found'));
        }
        return $user;
    }
public function getBy(array $condition) : User
    {
        if (!$user = User::find()->andWhere($condition)->limit(1)->one()) {
            throw new NotFoundException($this->i18n->t('setrun/user', 'User not found'));
        }
        return $user;
    }
public function getBy ( array $ condition ) : User { if ( ! $ user = User :: find ( ) -> andWhere ( $ condition ) -> limit ( 1 ) -> one ( ) ) { throw new NotFoundException ( $ this -> i18n -> t ( 'setrun/user' , 'User not found' ) ) ; } return $ user ; }
Get user by condition.
@param array $condition
@return User|array
Get user by condition .