protected function getsfEmailTemplateOrCreate($id = 'id') { if (!$this->getRequestParameter($id)) { $sf_email_template = new sfEmailTemplate(); } else { $sf_email_template = sfEmailTemplatePeer::retrieveByPk($this->getRequestParameter($id)); $this->forward404Unless($sf_email_template); } // delete existing email templates cached file so the changes are applied immediately $cache_file = sfConfig::get('sf_root_dir') . '/cache/frontend/prod/config/config_db_emailtemplates.yml.php'; sfToolkit::clearGlob($cache_file); $cache_file = sfConfig::get('sf_root_dir') . '/cache/backend/prod/config/config_db_emailtemplates.yml.php'; sfToolkit::clearGlob($cache_file); return $sf_email_template; }
public function execute($configFiles) { $databaseManager = new sfDatabaseManager(); $databaseManager->initialize(); $retval = "<?php\n" . "// auto-generated by " . __CLASS__ . "\n" . "// date: " . date('Y/m/d H:i:s') . "\n"; $email_templates = sfEmailTemplatePeer::doSelect(new Criteria()); if ($email_templates) { foreach ($email_templates as $et) { if ($et->getName()) { $retval .= "DEFINE('" . strtoupper($et->getName() . '_SUBJECT') . "','" . htmlentities($et->getSubject()) . "');\n"; } } } $retval .= "DEFINE('" . strtoupper($et->getName() . '_BODY') . "','" . htmlentities($et->getBody()) . "');\n"; $retval .= "DEFINE('" . strtoupper($et->getName() . '_TEXT_BODY') . "','" . htmlentities($et->getTextBody()) . "');\n"; $retval .= "?>\n"; return $retval; }
public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = sfEmailTemplatePeer::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) { $this->setId($arr[$keys[0]]); } if (array_key_exists($keys[1], $arr)) { $this->setName($arr[$keys[1]]); } if (array_key_exists($keys[2], $arr)) { $this->setSubject($arr[$keys[2]]); } if (array_key_exists($keys[3], $arr)) { $this->setBody($arr[$keys[3]]); } if (array_key_exists($keys[4], $arr)) { $this->setTextBody($arr[$keys[4]]); } if (array_key_exists($keys[5], $arr)) { $this->setCreatedAt($arr[$keys[5]]); } if (array_key_exists($keys[6], $arr)) { $this->setUpdatedAt($arr[$keys[6]]); } }
public static function retrieveByPKs($pks, $con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } $objs = null; if (empty($pks)) { $objs = array(); } else { $criteria = new Criteria(); $criteria->add(sfEmailTemplatePeer::ID, $pks, Criteria::IN); $objs = sfEmailTemplatePeer::doSelect($criteria, $con); } return $objs; }