sanders
sanders

Reputation: 10888

Using a Zend_Db_Expr

I have the following query:

$select = $this->getDao()->select()
                         ->from(
                           array(new Zend_Db_Expr('FROM_UNIXTIME(expiration)'))
                           );

The getDao function is a reference to my Data Access object class which looks like this:

class Model_Db_AccountresetDao extends Zend_Db_Table_Abstract
{
    protected $_name = 'accountreset';
    protected $_primary = 'reset_id';
}

Now i get this following error:

"Select query cannot join with another table"

This while i don't want to do a join. I just want to select that field as a unixTimestamp

How can I solve this problem?

All help is appreciated.

Tnx

Upvotes: 4

Views: 18257

Answers (1)

Vadyus
Vadyus

Reputation: 1329

If you are gettin select object from Zend_Db_Table_Abstract you can't pass him a ->from(). I think you should do like this

$select = $this->getDao()->select()  
                         ->from(this->getDao(),
                           array('_date or some field='.new Zend_Db_Expr('FROM_UNIXTIME(expiration)'))
                           );

or something like this.

Upvotes: 3

Related Questions