4

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

1 Answer 1

3

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.

Sign up to request clarification or add additional context in comments.

2 Comments

But then it become a condition and i don't want it to be a condition. I just want to select that field in a different format.
->from give's the select object table name to select from, you should you ->select(array('date'=>new Zend_Db_Expr('FROM_UNIXTIME(expiration)') to pass fields you wanna select

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.