[Dbix-class] How not to fetch relational object?

Oliver Gorwits oliver.gorwits at oucs.ox.ac.uk
Mon Dec 18 19:27:45 GMT 2006


vti,

vti wrote:
> Is there a way how not to fetch a relational object?
> For example I have artist and cd. Relationships are trivial.

You might want to consider an alternative column naming system...

For instance if a column stores the id of another table 'foo', call it 
'foo_id' and call the DBIx::Class relation to the other table just 
'foo'. Then, when you want the id use ->foo_id and when you want the 
relation use ->foo.

e.g. $cd->artist_id and $cd->artist->name

HTH,
regards,
oliver.
-- 
Oliver Gorwits, Network Infrastructure Group,
Oxford University Computing Services



More information about the Dbix-class mailing list