Re: joins with DB_DataOject

From: Date: Tue, 11 Nov 2003 06:22:03 +0000
Subject: Re: joins with DB_DataOject
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-8877@lists.php.net to get a copy of this message
Ian P. Christian wrote:
[cart] ItemId = Item:Id However, when doing this...
     $cart = new DataObjects_Cart;
     $cart->Username = Auth::getAuth();
     $item = new DataObjects_Item;
     $cart->joinAdd($item);
     $cart->find();
 
A few things to try.  First, try [Cart] instead of [cart] in your links file. Next, you need to fill in some search criteria for $item before you joinAdd(), otherwise you are telling it to join with all Item objects, eg,
$item->price = 7; $item->desc = 'widget'; should generate some sql roughly like "... WHERE Cart.Username="joe" AND Cart.ItemId = Item.Id AND Item.price=7 AND Item.desc="widget". hth, -mitch

« previous php.pear.general (#8877) next »