[jifty-devel] accessing Left and Right models through link table (LeftRight)

Jesse Vincent jesse at bestpractical.com
Sat Jul 14 00:02:28 EDT 2007


On Jul 12, 2007, at 7:22 PM, Matthew Lenz wrote:

> I've got a couple models and a link table as described in the trunk
> version of the Cookbook for implementing a many-to-many relationship.
>
> I'm having difficulty accessing information in the respective models
> through the link table collection.
>
> I've tried a couple different methods where $id is the left id.
>
> First try:
>
> $collection = MyApp::Model::LeftRightCollection->new();
> $collection->limit(column => "left", value => $id);
>
> while (my $left_right = $collection->next) {

#	Can you give me:

	warn ref($left_right);	

	warn ref($left_right->right);	

>     print $left_right->right->name;
> }
>


...and the actual code for your model classes?

Thanks!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 186 bytes
Desc: This is a digitally signed message part
Url : http://lists.bestpractical.com/pipermail/jifty-devel/attachments/20070714/387a69a8/PGP.pgp


More information about the jifty-devel mailing list