<div dir="ltr"><div class="gmail_default" style="font-family:trebuchet ms,sans-serif;color:rgb(0,0,102)">Hi folks<br><br></div><div class="gmail_default" style="font-family:trebuchet ms,sans-serif;color:rgb(0,0,102)">I&#39;m relatively new to this, so sorry if this is a silly question - and sorry if it goes to the wrong place (I&#39;m still not sure it&#39;s not a Template Toolkit issue):<br><br>I am developing a Catalyst application using DBIx::Class and Template 
Toolkit; in the particular part I&#39;m having issues with, I have a 
resultset obtained using by calling the following function in my 
ResultSet schema:<br><br><span style="font-family:monospace,monospace">    sub divisions_and_teams_in_season {<br>      my ( $self, $season, $grid ) = @_;<br><br>      return $self-&gt;search({<br>          &quot;division_seasons.season&quot;         =&gt; $season-&gt;id,<br>          &quot;division_seasons.fixtures_grid&quot;  =&gt; $grid-&gt;id,<br>        }, {<br>        prefetch  =&gt; [<br>          &quot;division_seasons&quot;,<br>          {<br>            &quot;team_seasons&quot; =&gt; {<br>              &quot;team&quot; =&gt; [{<br>                  &quot;club&quot; =&gt; &quot;venue&quot;<br>                },<br>                &quot;home_night&quot;<br>              ]<br>            }<br>          }<br>        ],<br>        order_by  =&gt; {<br>          -asc =&gt; [ qw( division_seasons.rank team_seasons.grid_position club.short_name <a href="http://team.name">team.name</a> ) ]<br>        }<br>      });<br>    }</span><br><br><br>This returns the data as I would expect and I&#39;m able to do the following
 in my Controller code to get back my resultset and iterate through the 
team_seasons:<br><br><span style="font-family:monospace,monospace">    my $divisions = [ $c-&gt;model(&quot;DB::Division&quot;)-&gt;divisions_and_teams_in_season($current_season, $c-&gt;stash-&gt;{grid}) ];<br><br>    foreach my $division ( @{ $divisions } ) {<br>      $c-&gt;log-&gt;debug( $division-&gt;team_seasons-&gt;grid_positions_filled ); # This works I guess because $division-&gt;team_seasons is a resultset object <br>    }</span><br><br>However, in my template (having stashed <code>$divisions</code>), I&#39;m 
unable to access the grid_positions_filled object because 
division.team_seaons gives me an arrayref of team resultsets in that 
division:<br><br><span style="font-family:monospace,monospace">    [%<br>    # Loop through our divisions<br>    FOREACH division IN divisions;<br>      CALL c.log.debug(division.team_seasons); # The output of this is something like: ARRAY(0x6f8318c)<br>    END;<br>    -%]</span><br><br><p>The output I get for the same debug log in my controller is more like a list of resultset objects:</p><p><br></p><span style="font-family:monospace,monospace">    TopTable::Model::DB::TeamSeason=HASH(0x6eea94c)<br>    TopTable::Model::DB::TeamSeason=HASH(0x6f01834)<br>    TopTable::Model::DB::TeamSeason=HASH(0x6ef5284)<br>    TopTable::Model::DB::TeamSeason=HASH(0x6efec9c)<br>    TopTable::Model::DB::TeamSeason=HASH(0x6ef4dc4)<br>    TopTable::Model::DB::TeamSeason=HASH(0x6faf0ac)<br>    TopTable::Model::DB::TeamSeason=HASH(0x6eefa04)</span><br><br><p>Hope all this makes sense!  Does anyone know how I can get the 
behaviour from the controller into the template so that I can access 
methods on the team_season ResultSet?</p>

<p>Thank you very much in advance.</p><p><br></p><p>Chris<br></p><br></div></div>