_getTable()->searchBy(array('email' => $email), 'id'))) { $this->setPrimaryKey($id); } return $this; } /** * Set primary key for recover code * * @param string $recoverCode * @return Obj */ public function setPrimaryKeyByRecoverCode($recoverCode) { if (false !== ($id = $this->_getTable()->searchBy(array('recoverCode' => $recoverCode), 'id'))) { $this->setPrimaryKey($id); } return $this; } /** * Set code for password recover * * @param string $recoverCode * @param string $expirationDate * @return Obj */ public function setRecoverCode($recoverCode, $expirationDate) { $updateData = array( 'recoverCode' => $recoverCode, 'recoverCodeExpirationDate' => $expirationDate ); $this->_getTable()->updateByKey($updateData, $this->_primaryKey); return $this; } protected function _insertDependency() { return $this; } protected function _updateDependency() { return $this; } protected function _deleteDependency() { return $this; } public function isValidEmail($email) { $select = $this->_db->select(); $select->from($this->_getPair('User'), new Zend_Db_Expr('1')); $select->where('email = ?', $email); $select->where('status = ?', Entity::STATUS_ACTIVE); $select->where('bought = ?', 'y'); return '1' === $this->_db->fetchOne($select); } }