public function setDefaultForm($title, $form = "default") { sfContext::getInstance()->getLogger()->info("Setting defaults for form [" . $title . "], setting form to (" . $form . ")"); // TODO: Going to sleep now, but seems like we need to prepend the title of the form before the form - "main_default" insted of just "default" // TODO: Maybe it's lack of sleep, but title<->form are mixed up, it seems $setting = ProjectSettingPeer::retrieveByProjectIdTitle($this->getId(), $title); if ($setting == null) { sfContext::getInstance()->getLogger()->info("Setting not found when setting default (normal behavior)"); $setting = new ProjectSetting(); $setting->setProjectId($this->getId()); $setting->setTitle('form_' . $title); $setting->setSetting($form); $setting->save(); } $new_form = ProjectFormPeer::retrieveByProjectIdTitle($this->getId(), $setting->getSetting()); if ($new_form == null) { sfContext::getInstance()->getLogger()->info("Form not found (normal behavior)"); $new_form = new ProjectForm(); $new_form->setProjectId($this->getId()); $new_form->setTitle($form); $new_form->save(); } sfContext::getInstance()->getLogger()->info("Form created, setting assigned. "); return $form; }