コード例 #1
0
 /** static **/
 function lookup($id)
 {
     return $id && ($cfg = new Config($id)) && $cfg->getId() == $id ? $cfg : null;
 }
コード例 #2
0
 function getConfig()
 {
     $cfg = new Config(1);
     return $cfg && $cfg->getId() ? $cfg : null;
 }
コード例 #3
0
ファイル: BaseModel.php プロジェクト: linkorb/saas
 public function addConfig(Config $config)
 {
     $this->configs[$config->getId()] = $config;
 }
コード例 #4
0
ファイル: actions.class.php プロジェクト: navid045/maxlaptop
 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();
 }
コード例 #5
0
ファイル: BaseAds.php プロジェクト: navid045/maxlaptop
 /**
  * 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;
 }
コード例 #6
0
ファイル: BaseConfigPeer.php プロジェクト: navid045/maxlaptop
 /**
  * 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;
     }
 }