[Catalyst] Using relations in catalyst
Matt S Trout
dbix-class at trout.me.uk
Mon Aug 22 23:29:20 CEST 2005
On Mon, Aug 22, 2005 at 10:48:41PM +0200, Wijnand Wiersma wrote:
> I think (no, I am sure) I don't get it yet.
> I have to Tables: pr_ping_def and server. I have setup both with a
> scaffolding controller.
> I changed M/CDBI.pm to use Catalyst::Model::CDBI::Sweet
> and in the M/CDBI/PrPingDef.pm I have:
> __PACKAGE__->has_a( server => 'Jabbernet::M::CDBI::Server' );
> I updated the default template (that get's generated when you want a
> scaffolding table) so it only displays the server and ipaddress columns.
> The server is displayed as a id.
> I want the column name of the server table to be displayed instead.
> I tried a lot of things, at the irc channel the suggestion was to use
> pr_ping_def.server.name, but now it doesn't output anything.
> Could it be a problem that the pr_ping_def table has multiple keys?
> If so, is it possible to fix this? I cannot alter the database design.
Welcome to Class::DBI, where multi-column PKs have never worked properly
and probably never will.
I'd suggest you join the dbix-class mailing list (linked from the wiki
mentioned in my sig) and have a go at using an ORM that was designed to
support multi-column PKs from the ground up.
Class::DBI does a lot of things very well; multiple PKs are, however,
definitely not one of those things.
Matt S Trout Website: http://www.shadowcatsystems.co.uk
Technical Director E-mail: mst (at) shadowcatsystems.co.uk
Shadowcat Systems Ltd.
+ Help us build a better perl ORM: http://dbix-class.shadowcatsystems.co.uk/ +
More information about the Catalyst