#------------------------------------------------------------
# Copyright (C) 2006 RoyaltyShare, Inc.   All Rights Reserved
# $Id$
#------------------------------------------------------------
package RPS::Song::ComposerList;

use strict;
use warnings;

use lib '/app/tools/rps/lib';
use RPS::DB::Item::Composer;
use RPS::Song::Composer;

use Common::FormObject;
use base 'Common::FormObject';

# This is a read-only XMLObject, so we don't need any
# of the accessor methods, just create the list of
# items and be on your way.
#

sub _init {
    my ( $self, %args ) = @_;

    $self->SUPER::_init(%args);

    $self->{Composer} = [];

    #my $composerCollection = RPS::DB::Item::Composer->GetAll();
    my $composerCollection = RPS::DB::Item::Composer->Search( searchTerm => $args{query}, limit => $args{limit} );

    while ( $composerCollection->hasNext() ) {
        my $composerObj = $composerCollection->next();
        push @{ $self->{Composer} }, RPS::Song::Composer->new( _dbItem => $composerObj );
    }

    return $self;
}

1;
