put() public method

config change
public put ( string $group, array $collection, boolean $toDesc = false, callable $filter = null, string $siteKey = 'default' ) : ConfigEntity
$group string the name of target
$collection array items and values to be set
$toDesc boolean descendants modify if true
$filter callable filter function
$siteKey string site key
return ConfigEntity
 /**
  * update document instance config
  * * Cannot changed 'division', 'revision' configure.
  *
  * @param ConfigEntity $config document instance config
  * @return ConfigEntity
  */
 public function put(ConfigEntity $config)
 {
     if ($this->get($config->get('instanceId')) === null) {
         throw new ConfigNotFoundException(['instanceId' => $config->get('instanceId')]);
     }
     $this->configManager->put(sprintf('%s.%s', self::CONFIG_NAME, $config->get('instanceId')), $config->getPureAll());
     return $config;
 }
 /**
  * update document instance config
  * * division, revision 설정 변경 불가.
  *      - 이 설정에 대한 변경은 core 에서 제공 안함.
  *
  * @param ConfigEntity $config document instance config
  * @return ConfigEntity
  */
 public function put(ConfigEntity $config)
 {
     if ($this->get($config->get('instanceId')) === null) {
         throw new Exceptions\ConfigException();
     }
     $diff = $config->diff();
     if (isset($diff['instanceId']) === null) {
         throw new Exceptions\ConfigException();
     }
     $this->configManager->put(sprintf('%s.%s', self::CONFIG_NAME, $config->get('instanceId')), $config->getPureAll());
     return $config;
 }
 /**
  * 사용할 아이템들을 설정에 저장
  *
  * @param string      $id         target plugin id
  * @param string|null $instanceId instance id
  * @param array       $keys       menu item keys
  * @return \Xpressengine\Config\ConfigEntity
  */
 public function setActivates($id, $instanceId = null, array $keys = [])
 {
     $configKey = $this->getConfigKey($id, $instanceId);
     $config = [];
     if (count($keys) > 0) {
         $config = ['activate' => $keys];
     }
     if (!$this->cfg->get($configKey)) {
         return $this->cfg->add($configKey, $config);
     }
     return $this->cfg->put($configKey, $config);
 }
 /**
  * Process to Update
  *
  * @param string $instanceId     to store instance id
  * @param array  $menuTypeParams for menu type store param array
  * @param array  $itemParams     except menu type param array
  *
  * @return mixed
  * @throws \Exception
  */
 public function updateMenu($instanceId, $menuTypeParams, $itemParams)
 {
     $configName = $this->getPageConfigKeyString($instanceId);
     XeDB::beginTransaction();
     try {
         $affected = $this->configManager->put($configName, $menuTypeParams);
     } catch (\Exception $e) {
         XeDB::rollback();
         throw $e;
     }
     XeDB::commit();
     return $affected;
 }
 public function testPutChangeAllAndReturns()
 {
     list($repo, $validator) = $this->getMocks();
     $mockConfig = m::mock('Xpressengine\\Config\\ConfigEntity');
     $mockConfig->name = 'board.notice';
     $mockConfig->shouldReceive('set')->once()->with('listCount', 20)->andSet('listCount', 20);
     $mockConfig->shouldReceive('set')->once()->with('downloadable', true)->andSet('downloadable', true);
     $mockConfig->shouldReceive('clear')->andReturnNull();
     $repo->shouldReceive('find')->once()->with('default', 'board.notice')->andReturn($mockConfig);
     $repo->shouldReceive('fetchParent')->with('default', 'board.notice')->andReturn([]);
     $repo->shouldReceive('save')->once()->with($mockConfig)->andReturn($mockConfig);
     $repo->shouldReceive('fetchChildren')->with('default', 'board.notice')->andReturn([]);
     $instance = new ConfigManager($repo, $validator);
     $config = $instance->put('board.notice', ['listCount' => 20, 'downloadable' => true], true);
     $this->assertEquals(20, $config->listCount);
     $this->assertEquals(true, $config->downloadable);
 }
 /**
  * add config
  *
  * @param array $params parameters
  * @return ConfigEntity
  * @throws \Xpressengine\Config\Exceptions\InvalidArgumentException
  */
 public function put(array $params)
 {
     return $this->configManager->put($this->name($params['boardId']), $params);
 }
 /**
  * set config
  *
  * @param string $counterName counter name
  * @param string $type        counter type
  * @return void
  */
 public function set($counterName, $type = Counter::TYPE_ID)
 {
     $config = $this->configManager->get($this->name);
     $config->set($counterName, $type);
     $this->configManager->put($this->name, $config->getPureAll());
 }
 /**
  * config 수정
  *
  * @param ConfigEntity $config config entity
  * @return void
  */
 public function put(ConfigEntity $config)
 {
     $this->configManager->put($this->getConfigName($config), $config->getPureAll());
 }