[Catalyst] DBI search method problems

Mark Blythe list at markblythe.com
Tue Feb 28 01:07:01 CET 2006


It's only showing one because this line assigns only the first element
of the returned array into $c->stash->{stations}:

>         ($c->stash->{stations}) =
>             dbtest::Model::CDBI::Stationcontest->search(contest_id => $contest_id);

You should probably use the iterator if you want to access them all. 
You start by assigning to a scalar, which returns an iterator object:

$c->stash->{stations} =
dbtest::Model::CDBI::Stationcontest->search(contest_id =>
$contest_id);

Then in your template, call next() on the iterator:

[% WHILE (s = stations.next) %]
    [% s.call_letters %]
[% END %]

...or something very much like that



More information about the Catalyst mailing list