[Catalyst] Troubles with mysql joins and template toolkit
Matt S Trout
dbix-class at trout.me.uk
Tue May 23 18:34:39 CEST 2006
Mauro Andreolini wrote:
> Now, as hard as I try, I cannot get the t.role variable to display :-(
> Instead, I get an error screen telling me that 'role' is undefined.
> This is quite logical, because, surfing through the Catalyst classes,
> I see that t is a 'science::Model::DBIC::Teacher' blessed structure
> (that reflects the teacher table), so I think it cannot contain fields
> from another table (role). But how can I display the fields of an inner
> join that do not belong to the teacher table?
> Any suggestion is welcome.
First, switch to Catalyst::Model::DBIC::Schema; DBIC::Plain is ancient,
crufty and pretty much deprecated.
Second, have a look at the DBIx::Class docs - if you declare that
relationship as a belongs_to rather than using the (raw, designed for
expert use only) add_relationship method you'll get a role accessor
method that will work as expected.
More information about the Catalyst