public function save()
 {
     $config = Doctrine::getTable('SnsConfig')->retrieveByName($this->configName);
     if (!$config) {
         $config = new SnsConfig();
         $config->setName($this->configName);
     }
     $config->setValue($this->getValue('ip_list'));
     $config->save();
 }
 public function save($themeName)
 {
     $snsConfigTable = Doctrine::getTable('SnsConfig')->retrieveByName('Theme_used');
     if (null === $snsConfigTable) {
         $snsConfigTable = new SnsConfig();
         $snsConfigTable->setName('Theme_used');
     }
     $snsConfigTable->setValue($themeName);
     $snsConfigTable->save();
     return true;
 }
 public function set($name, $value)
 {
     $config = $this->retrieveByName($name);
     if (!$config) {
         $config = new SnsConfig();
         $config->setName($name);
     }
     $config->setValue($value);
     $this->configs[$name] = $config;
     return $config->save();
 }
 public function save()
 {
     $config = sfConfig::get('openpne_sns_config');
     foreach ($this->getValues() as $key => $value) {
         $snsConfig = Doctrine::getTable('SnsConfig')->retrieveByName($key);
         if (!$snsConfig) {
             $snsConfig = new SnsConfig();
             $snsConfig->setName($key);
         }
         $snsConfig->setValue($value);
         $snsConfig->save();
     }
 }
 public function save()
 {
     foreach ($this->getValues() as $key => $value) {
         $snsConfig = Doctrine::getTable('SnsConfig')->findOneByName($key);
         if (!$snsConfig) {
             $snsConfig = new SnsConfig();
             $snsConfig->setName($key);
         }
         $snsConfig->setValue($value);
         $snsConfig->save();
     }
     return true;
 }
 public function save()
 {
     if (!$this->isValid()) {
         return false;
     }
     $snsConfig = Doctrine::getTable('SnsConfig')->retrieveByName($this->layoutName);
     if (!$snsConfig) {
         $snsConfig = new SnsConfig();
         $snsConfig->setName($this->layoutName);
     }
     $value = $this->choices[$this->values['layout']];
     $snsConfig->setValue($value);
     return (bool) $snsConfig->save();
 }
 public function save()
 {
     foreach ($this->getValues() as $k => $v) {
         if (!isset($this->configs[$k])) {
             continue;
         }
         $config = Doctrine::getTable('SnsConfig')->retrieveByName($this->configs[$k]);
         if (!$config) {
             $config = new SnsConfig();
             $config->setName($this->configs[$k]);
         }
         $config->setValue($v);
         $config->save();
     }
 }
 public function save()
 {
     foreach ($this->getValues() as $k => $v) {
         $key = opPluginChannelServerPluginConfiguration::CONFIG_KEY_PREFIX . $k;
         $config = Doctrine::getTable('SnsConfig')->retrieveByName($key);
         if (!$config) {
             $config = new SnsConfig();
             $config->setName($key);
         }
         $config->setValue($v);
         $config->save();
         if (!$v) {
             $config->delete();
         }
     }
 }
Exemple #9
0
<?php

include_once dirname(__FILE__) . '/../../../bootstrap/unit.php';
include_once dirname(__FILE__) . '/../../../bootstrap/database.php';
$t = new lime_test(6, new lime_output_color());
$snsConfig1 = Doctrine::getTable('SnsConfig')->find(1);
$snsConfig2 = Doctrine::getTable('SnsConfig')->find(2);
$snsConfig3 = new SnsConfig();
$snsConfig3->setName('xxxxxxxxxx');
//------------------------------------------------------------
$t->diag('SnsConfig');
$t->diag('SnsConfig::getConfig()');
$t->isa_ok($snsConfig1->getConfig(), 'array');
$t->isa_ok($snsConfig2->getConfig(), 'array');
$t->ok(!$snsConfig3->getConfig());
//------------------------------------------------------------
$t->diag('SnsConfig::getValue()');
$t->is($snsConfig1->getValue(), 'test1');
//------------------------------------------------------------
$t->diag('SnsConfig::setValue()');
$snsConfig2->setValue(array('0', '1'));
$t->is($snsConfig2->getValue(), array('0', '1'));
$t->is($snsConfig2->rawGet('value'), serialize($snsConfig2->getValue()));
$t->isa_ok($table->find(3), 'IntroFriend', 'introductory of friend is exist');
$t->isa_ok($table->find(4), 'IntroFriend', 'introductory of non friend is exist');
$t->isa_ok($table->find(5), 'IntroFriend', 'introductory of non friend is exist');
$t->isa_ok($table->find(6), 'IntroFriend', 'introductory of non friend is exist');

// run the migrate
//--------------------
$t->info('run migrate of The opIntroFriendPlugin');

// set revision
$snsConfig = Doctrine::getTable('SnsConfig')->createQuery()
->where('name = ?', 'opIntroFriendPlugin_revision')
->fetchOne();
if (!$snsConfig)
{
  $snsConfig = new SnsConfig();
  $snsConfig->setName('opIntroFriendPlugin_revision');
}
$snsConfig->setValue(2);
$snsConfig->save();

// execute
exec('./symfony openpne:migrate --target=opIntroFriendPlugin');

// success tests
//--------------------
$t->info('After running the migration of opIntroFriendPlugin');

$t->is($table->createQuery()->count(), 3, 'count of intro_friend');
$t->isa_ok($table->find(1), 'IntroFriend', 'introductory of friend is exist');
$t->isa_ok($table->find(2), 'IntroFriend', 'introductory of friend is exist');