Gc\Core\Config::setValue PHP Method

setValue() public method

Set config value
public setValue ( string $identifier, string $value ) : boolean
$identifier string Identifier
$value string Value
return boolean
    public function setValue($identifier, $value)
    {
        if (empty($identifier)) {
            return false;
        }
        $row = $this->fetchRow($this->select(array('identifier' => $identifier)));
        if (!empty($row)) {
            $where = new Where();
            return $this->update(array('value' => $value), $where->equalTo('identifier', $identifier));
        } else {
            return $this->insert(array('value' => $value, 'identifier' => $identifier));
        }
    }

Usage Example

示例#1
0
 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  *
  * @return void
  */
 protected function setUp()
 {
     $coreConfig = new CoreConfig();
     $coreConfig->setValue('stream_wrapper_is_active', 1);
     $this->object = new Partial($coreConfig);
     $coreConfig->setValue('stream_wrapper_is_active', 0);
     $this->view = ViewModel::fromArray(array('name' => 'View Name', 'identifier' => 'view-identifier', 'description' => 'View Description', 'content' => 'View Content'));
     $this->view->save();
     $view = new View();
     $templatePathStack = new TemplatePathStack();
     $templatePathStack->addPath(GC_TEMPLATE_PATH);
     $view->setResolver($templatePathStack);
     $this->object->setView($view);
 }
All Usage Examples Of Gc\Core\Config::setValue