public function restoreAccessByEmail($email) { $sql = $this->db->select()->from($this->table, array('email', 'username', 'password', 'id'))->where('email = ?', $email); $user = $this->db->fetchRow($sql); if ($user) { $attributes = $this->emailTemplate->getHandledTemplate('restore.access', array('user' => $user)); $this->mail->setAttributes($attributes); $this->mail->send($user['email']); return true; } $this->addError('User with this email not found'); return false; }