Using a Zend_Db_Expr

16,890

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.

Share:
16,890

Related videos on Youtube

sanders
Author by

sanders

Updated on May 25, 2022

Comments

  • sanders
    sanders almost 2 years

    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

  • sanders
    sanders over 13 years
    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.
  • Vadyus
    Vadyus over 13 years
    ->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