Thank you, I never would have noticed that the html comments does not affect to 
the TT/Catlayst logic.


But the problem remains the same, because I want to retrieve some columns from 
the main table an some from the related one, so I was told to use Prefetch.

What I really need is something as simple as this query (that I can use 
everywhere):

SELECT books.title, contents.content_en
FROM books, contents
WHERE books.id = 1111
AND contents.id = 1111

I am be very surprised that I am stuck with it!!


Regards:
Migue



________________________________
De: Jorge Gonzalez <[email protected]>
Para: [email protected] 
Enviado: lunes 9 de enero de 2012 10:49
Asunto: Re: [Dbix-class] I get only one in a one to one


You have commented out the line where you get content_en from the CONTENTS 
table, but you have done so _in HTML_. The template engine is running your 
template, including your HTML comment, and is getting the content_en field, 
just to put it in an HTML comment.

If you want to avoid the TT engine calling the relationship you must comment 
the call _inside_ the TT code, i.e.:

(...)

[% FOREACH book IN books -%]
  <tr>
<td>[% book.title %]</td>
        <td>[% # book.the_content.content_en %]</td>

  </tr>
[% END -%](...)

And something more: if you just want a column from a relation, do a join, not a 
prefetch:
_______________________________________________
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]

Reply via email to