select object as the third argument. It's been a while since I've used
Zend_Db but I believe it's something like this:
$select = $dependentTable->select();
$select->sort('some_field');
$row = $table->find(123);
$dependentRowset = $row->findDependentRowset($dependentTable, null,
$select);
--
*Hector Virgen*
Sr. Web Developer
http://www.virgentech.com
On Wed, Oct 27, 2010 at 11:26 PM, Kumar Sekhar <kumar_sekhar@hotmail.com>wrote:
>
> I am using findDependentRowset(). I get my Rowset back but I need to sort
> the
> results by one of the columns in the dependent table. How can I do that?
> Please help !!
>
>
> In my project, I am working with Orders and their attending events. There
> is
> a one to many relationship between order and events. One order can have
> many
> events applied but a event belongs to only one order. I have the following
> database tables and classes (stripped down for the sake of this example):
>
>
>
> CREATE TABLE IF NOT EXISTS `bbcms_order` ( `oid` int(11) NOT NULL
> auto_increment, `salutation` varchar(10) NOT NULL, `fname` varchar(100) NOT
> NULL, `lname` varchar(100) NOT NULL, `mname` varchar(100) NOT NULL,
> `address` text NOT NULL, `postcode` varchar(10) NOT NULL, `plaats` int(5)
> NOT NULL, `telefoon` varchar(15) NOT NULL, `email` varchar(200) NOT NULL,
> `newsletter_optin` char(1) NOT NULL default '0', `membership_no`
> varchar(10)
> NOT NULL, `offline_sent` char(1) NOT NULL default '0', `order_total`
> varchar(10) NOT NULL, `order_status` char(1) NOT NULL, `status` char(1) NOT
> NULL default '1', PRIMARY KEY (`oid`) ) ENGINE=InnoDB DEFAULT
> CHARSET=latin1
> COMMENT='Order Master Table' AUTO_INCREMENT=7 ;
>
>
>
> CREATE TABLE IF NOT EXISTS `bbcms_order_event_data` ( `id` int(11) NOT NULL
> auto_increment, `order_id` int(11) NOT NULL, `event_id` int(11) NOT NULL,
> `timeslot_id` int(11) NOT NULL, `attending_person` int(3) NOT NULL,
> `event_status` char(2) NOT NULL, PRIMARY KEY (`id`), KEY `order_id`
> (`order_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=6 ;
>
>
> Regards,
> Kumar Sekhar
>
>
> --
> View this message in context:
> http://zend-framework-community.634137.n4.nabble.com/findDependentRowset-sorting-issues-tp3016667p3016667.html
> Sent from the Zend DB mailing list archive at Nabble.com.
>
没有评论:
发表评论