[Rt-devel] [Searchbuilder] how to access fields from both joined tables in a SearchBuilder object
mathieu.lafage at anevia.com
Mon Oct 4 11:33:57 EDT 2010
I believe I reached the correct place for a question about
otherwise please forgive my noise.
I read the module documentation, the "RT Essential" book, I crawled this ML
archives, as well as google, and I gave a look at RT source code,
however I admit
I did not dive very deep in Tickets.pm generic query code, but I did not
a clear answer to this question :
Can you access fields from both joined tables in your result set
when you join two tables with Searchbuilder ?
From my understanding and tests, this is not possible, or not obviously.
You SearchBuilder-derived class is connected to one table (through
$self->Table('mytable'); ) and you thus return records of a
type linked to this base table.
Should I :
- forget using SearchBuilder for this purpose, it can not do it. period,
- create a proper view in my database, and create a SearchBuilder object
thus working around the SearchBuilder "limitation" described here,
- go back to "Modeling 101" and learn why what I want to do is bad.
Please, teach me.
- use the splendid solution you will certainly describe here. :)
NB: I thought about the two following solutions, but I want to know if
a better (more general) way :
1) I may define my tables so I don't need to perform a Join in the first
get related informations, but I'm afraid normalization might suffer
2) Alternately, I may access my two tables separately (with a
each) and "join" in the perl code, but I'm afraid I will call this a kludge.
More information about the rt-devel