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; }
public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = ProjectFormPeer::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) { $this->setId($arr[$keys[0]]); } if (array_key_exists($keys[1], $arr)) { $this->setProjectId($arr[$keys[1]]); } if (array_key_exists($keys[2], $arr)) { $this->setUuid($arr[$keys[2]]); } if (array_key_exists($keys[3], $arr)) { $this->setTitle($arr[$keys[3]]); } if (array_key_exists($keys[4], $arr)) { $this->setSetting($arr[$keys[4]]); } if (array_key_exists($keys[5], $arr)) { $this->setDescription($arr[$keys[5]]); } if (array_key_exists($keys[6], $arr)) { $this->setWidget1($arr[$keys[6]]); } if (array_key_exists($keys[7], $arr)) { $this->setWigest1Setting($arr[$keys[7]]); } if (array_key_exists($keys[8], $arr)) { $this->setWidget2($arr[$keys[8]]); } if (array_key_exists($keys[9], $arr)) { $this->setWigest2Setting($arr[$keys[9]]); } if (array_key_exists($keys[10], $arr)) { $this->setWidget3($arr[$keys[10]]); } if (array_key_exists($keys[11], $arr)) { $this->setWigest3Setting($arr[$keys[11]]); } if (array_key_exists($keys[12], $arr)) { $this->setWidget4($arr[$keys[12]]); } if (array_key_exists($keys[13], $arr)) { $this->setWigest4Setting($arr[$keys[13]]); } }
public function countProjectForms($criteria = null, $distinct = false, $con = null) { include_once 'lib/model/om/BaseProjectFormPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } elseif ($criteria instanceof Criteria) { $criteria = clone $criteria; } $criteria->add(ProjectFormPeer::PROJECT_ID, $this->getId()); return ProjectFormPeer::doCount($criteria, $distinct, $con); }
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(ProjectFormPeer::ID, $pks, Criteria::IN); $objs = ProjectFormPeer::doSelect($criteria, $con); } return $objs; }