On 1 Jan 2012, at 19:02, Miguel Barco wrote:
> return
> $self->search(the_main_query_to_search_the_main_rows)->search_related(the_has_one_accessor)
>
> The query retrieves just the expected rows (using columns of the first table
> for WHERE and ORDER). But the SELECT only contains the columns and data from
> the related, secondary table!!!! Nothing from the first one.
Thats basically what you would expect - if you want joined items then you need
to add a join/prefetch into the search attributes.
Which would make the code look like:-
return $self->search({the_main_query_to_search_the_main_rows},
{prefetch=>' the_has_one_accessor'});
https://metacpan.org/module/DBIx::Class::ResultSet#prefetch
https://metacpan.org/module/DBIx::Class::Manual::Cookbook#Using-joins-and-prefetch
Nigel.
--
[ Nigel Metheringham ------------------------------ [email protected] ]
[ Ellipsis Intangible Technologies ]
_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/[email protected]