[Dbix-class] I get only one in a one to one

Miguel Barco miguelelelele at yahoo.es
Sun Jan 1 19:02:04 GMT 2012


Hi, I have two related tables, using one-to-one. The second table is the pr=
olongation of the first one (old structure; too much columns for the ancien=
t db engine where it was created; and it can=B4t be changed). Most of the t=
ime I need to retrieve data form the two tables.

I have a Result set for it executed from a Controller in Catalyst. And beca=
use it is MySql MyIsam I added the "has_one" relationship in the Result sch=
ema by hand.

return $self->search(the_main_query_to_search_the_main_rows)->search_relate=
d(the_has_one_accessor)

The query retrieves just the expected rows (using columns of the first tabl=
e for=A0WHERE=A0and=A0ORDER). But the SELECT only contains the columns and =
data from the related, secondary table!!!! Nothing from the first one.

I can see the executed SELECT with the DBIC_TRACE, and it only calls for co=
lumns in the related table. The rs object for the template is filed with da=
ta from the secondary.

I tried to specify the columns using "columns =3D> " and they appear in the=
 query. Fine. But the only objects available in the Template Toolkit rs obj=
ect are the ones from the related, secondary table.

So I am sure that I am missing something or misunderstanding the whole conc=
ept of the DBIC query.

Regards:
Migue.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20120101/c9d=
f0e75/attachment.htm


More information about the DBIx-Class mailing list