Ian,

Might be better off just building a query with Zend_Db_Select.  The manual
has examples.  Be aware that the .8 version of Zend_Db_Select is basically
non-functional so use the .7 version.

>
> -- Ian Warner <[EMAIL PROTECTED]> wrote
> (on Thursday, 08 March 2007, 05:56 PM -0000):
>> That would be why then :)
>>
>> Been pulling my hair out for quite a while to solve this.
>>
>> So it is basically not possible to do a COUNT(*) etc or any
>> functionality
>> with the column selects
>
> Well, it is possible, just not using the class's find() and fetchAll()
> methods.
>
> I have methods like the following in many of my Zend_Db_Table classes:
>
>     public function fetchInfo($id)
>     {
>         $select = $this->select();
>         $select->from($this->_name, array('id', 'username', 'email'))
>                ->where('id = ?', $id);
>
>         $row = $this->getAdapter()->fetchRow($select);
>         return $row;
>     }
>
> You don't end up with Zend_Db_TableRow|set results, but you do end up
> getting the exact columns you desire -- and you can use constructs like
> COUNT(*) in your from clause in your select object. I've found
> Zend_Db_Table + Zend_Db_Select to be a very flexible, powerful
> combination.
>
>> > -----Original Message-----
>> > From: Bill Karwin [mailto:[EMAIL PROTECTED]
>> > Sent: 08 March 2007 17:52
>> > To: Ian Warner; Zend Framework General
>> > Subject: RE: [fw-general] DB Table
>> >
>> > > From: Ian Warner [mailto:[EMAIL PROTECTED]
>> > > Now I want to be able to adjust what columns are selected I cannot
>> see
>> > > this in the DB table code or in the documentation.
>> >
>> > Currently Zend_Db_Table selects all columns from the table.
>> > It is currently a feature request to allow the app to specify which
>> > columns it fetches.  This is not implemented yet.
>> >
>> > http://framework.zend.com/issues/browse/ZF-694
>> >
>> > To be honest, I would have to say that it is not likely to be
>> > implemented in the next release of Zend_Db.
>
> --
> Matthew Weier O'Phinney
> PHP Developer            | [EMAIL PROTECTED]
> Zend - The PHP Company   | http://www.zend.com/
>
>


Reply via email to