/** static **/
 function lookup($id)
 {
     return $id && ($cfg = new Config($id)) && $cfg->getId() == $id ? $cfg : null;
 }
Example #2
0
 function getConfig()
 {
     $cfg = new Config(1);
     return $cfg && $cfg->getId() ? $cfg : null;
 }
Example #3
0
 public function addConfig(Config $config)
 {
     $this->configs[$config->getId()] = $config;
 }
Example #4
0
 public function executeProcessConfigForm(sfWebRequest $request)
 {
     $data = $request->getGetParameters();
     $config = new Config();
     if ($data['cid'] == '-1') {
         // New Config
         $config->setModelId($data['mid']);
         $config->save();
         foreach ($data as $field => $value) {
             if ($field != 'cid' && $field != 'mid') {
                 $fv = new FieldValue();
                 $fv->setConfigId($config->getId());
                 $fv->setFieldId(intval($field));
                 $fv->setValue($value);
                 //echo intval($field)."\n";
                 $fv->save();
             }
         }
     } else {
         $config = ConfigPeer::retrieveByPK($data['cid']);
         foreach ($data as $field => $value) {
             if ($field != 'cid' && $field != 'mid') {
                 $c = new Criteria();
                 $c->add(FieldValuePeer::FIELD_ID, intval($field));
                 $c->add(FieldValuePeer::CONFIG_ID, $config->getId());
                 $fv = FieldValuePeer::doSelectOne($c);
                 if (!is_object($fv)) {
                     $fv = new FieldValue();
                     $fv->setConfigId($config->getId());
                     $fv->setFieldId(intval($field));
                 }
                 $fv->setValue($value);
                 //echo intval($fv->getValue())."#";
                 //print_r($fv, FALSE);
                 $fv->save();
             }
         }
     }
     $this->res = $config->getId();
 }
Example #5
0
 /**
  * Declares an association between this object and a Config object.
  *
  * @param      Config $v
  * @return     Ads The current object (for fluent API support)
  * @throws     PropelException
  */
 public function setConfig(Config $v = null)
 {
     if ($v === null) {
         $this->setConfigId(NULL);
     } else {
         $this->setConfigId($v->getId());
     }
     $this->aConfig = $v;
     // Add binding for other direction of this n:n relationship.
     // If this object has already been added to the Config object, it will not be re-added.
     if ($v !== null) {
         $v->addAds($this);
     }
     return $this;
 }
Example #6
0
 /**
  * Adds an object to the instance pool.
  *
  * Propel keeps cached copies of objects in an instance pool when they are retrieved
  * from the database.  In some cases -- especially when you override doSelect*()
  * methods in your stub classes -- you may need to explicitly add objects
  * to the cache in order to ensure that the same objects are always returned by doSelect*()
  * and retrieveByPK*() calls.
  *
  * @param      Config $value A Config object.
  * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool(Config $obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if ($key === null) {
             $key = (string) $obj->getId();
         }
         // if key === null
         self::$instances[$key] = $obj;
     }
 }