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

vti mbit at ukr.net
Mon Dec 18 20:25:12 GMT 2006


On Mon, Dec 18, 2006 at 07:27:45PM +0000, Oliver Gorwits wrote:
> 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
> 

Wow. That's cool. Thanks a lot!

-- 
vti -- Viacheslav Tikhanovskii
Moreover, my father, see, yea, see the skirt of thy robe in my hand:
for in that I cut off the skirt of thy robe, and killed thee not, know
thou and see that there is neither evil nor transgression in mine hand,
and I have not sinned against thee; yet thou huntest my soul to take it.
		 -- 1 Samuel 24:11



More information about the Dbix-class mailing list