/**
     * Internal function to return an email template object from a row.
     * @param $row array
     * @return EmailTemplate
     */
    function &_returnEmailTemplateFromRow(&$row)
    {
        $emailTemplate = new EmailTemplate();
        $emailTemplate->setEmailKey($row['email_key']);
        $emailTemplate->setEnabled($row['enabled']);
        $emailTemplate->setCanDisable($row['can_disable']);
        if (!HookRegistry::call('EmailTemplateDAO::_returnEmailTemplateFromRow', array(&$emailTemplate, &$row))) {
            $result =& $this->retrieve('SELECT d.locale, d.description, d.subject, d.body
				FROM email_templates_data AS d
				WHERE d.email_key = ?', $row['email_key']);
            while (!$result->EOF) {
                $dataRow =& $result->GetRowAssoc(false);
                $emailTemplate->addLocale($dataRow['locale']);
                $emailTemplate->setSubject($dataRow['locale'], $dataRow['subject']);
                $emailTemplate->setBody($dataRow['locale'], $dataRow['body']);
                $emailTemplate->setDescription($dataRow['locale'], $dataRow['description']);
                $result->MoveNext();
            }
            $result->Close();
            unset($result);
        }
        return $emailTemplate;
    }
 /**
  * Internal function to return an email template object from a row.
  * @param $row array
  * @return EmailTemplate
  */
 function &_returnEmailTemplateFromRow(&$row, $isCustomTemplate = null)
 {
     $emailTemplate = new EmailTemplate();
     $emailTemplate->setEmailId($row['email_id']);
     $emailTemplate->setAssocType($row['assoc_type']);
     $emailTemplate->setAssocId($row['assoc_id']);
     $emailTemplate->setEmailKey($row['email_key']);
     $emailTemplate->setLocale($row['locale']);
     $emailTemplate->setSubject($row['subject']);
     $emailTemplate->setBody($row['body']);
     $emailTemplate->setEnabled($row['enabled'] == null ? 1 : $row['enabled']);
     $emailTemplate->setCanDisable($row['can_disable']);
     $emailTemplate->setFromRoleId($row['from_role_id']);
     $emailTemplate->setToRoleId($row['to_role_id']);
     if ($isCustomTemplate !== null) {
         $emailTemplate->setCustomTemplate($isCustomTemplate);
     }
     HookRegistry::call('EmailTemplateDAO::_returnEmailTemplateFromRow', array(&$emailTemplate, &$row));
     return $emailTemplate;
 }