zend framework - Database expression not used in query -
can tell me why expression not used in query below?
select
accountreset
.*accountreset
(reset_id = '34') limit 1
public function findbyresetid($resetid, $model = null) { $result = null; if (isset($resetid)) { $select = $this->getdao()->select( array('expiration' => new zend_db_expr('unix_timestamp(expiration)')) ); $select->where('reset_id = ?', $resetid); $row = $this->getdao()->fetchrow($select); if (null != $row) { if (!($model instanceof stage5_model_passwordresetter)) { $model = new stage5_model_passwordresetter(); } // vul het model object $model->setresetid($row->reset_id); $model->setuserid($row->user_id); $model->setexpiration($row->expiration); $result = $model; } } return $result; }
your zend_db_expr
should go from()
method instead of select()
$select = $this->getdao() ->select() ->from( $this->getdao()->info('name'), array('expiration' => new zend_db_expr('unix_timestamp(expiration)')) );
Comments
Post a Comment