Re: DB_DataObject joinAdd question
| From: | Justin Patrin | Date: | Wed, 20 Jul 2005 23:15:23 +0000 |
| Subject: | Re: DB_DataObject joinAdd question | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-20084@lists.php.net to get a copy of this message | ||
On 7/20/05, Ed Greenberg <edg@greenberg.org> wrote:
> Trying to get my use of joinadd correct:
>
> // so I set up my two objects
> $dboi = DB_DataObject::factory('item');
> $dboc = DB_DataObject::factory('category');
>
> // and join 'em together
>
> $dboi->joinadd($dboc);
>
> // I set up the first two where conditions
> $dboi->member_id = $member_id;
> $dboi->item_status = 'approved';
>
> // And now I want to select on a column in category.
> // I tried $dboi->_dboc->item_class = $item_class
> // and a few other permutations, but finally wound up with:
>
> $dboi->whereadd("category.item_class =
> '$item_class'");
>
> So was there something I could have done other than the whereadd?
>
> Note that I also have
> [item]
> category_id = category:category_id
>
> in my links file.
>
You're missing the simplest possibility which is:
$dboc->category_id = $item_class;
I suggest you put this before the joinAdd call as I'm not sure if the
DO is passed by-ref or not.
--
Justin Patrin