save() публичный Метод

save
public save ( ConfigEntity $config ) : ConfigEntity
$config ConfigEntity config object
Результат ConfigEntity
Пример #1
0
 /**
  * save
  *
  * @param ConfigEntity $config config object
  * @return ConfigEntity
  */
 public function save(ConfigEntity $config)
 {
     $this->erase($config->siteKey, $config->name);
     return $this->repo->save($config);
 }
Пример #2
0
 /**
  * convey to descendants
  *
  * @param ConfigEntity $config config instance
  * @param callable     $filter filter function
  * @param array        $items  item key list
  * @return void
  */
 protected function convey(ConfigEntity $config, callable $filter = null, array $items = null)
 {
     $descendants = $this->repo->fetchDescendant($config->siteKey, $config->name);
     /** @var ConfigEntity $descendant */
     foreach ($descendants as $descendant) {
         if ($filter === null || call_user_func($filter, $descendant) === true) {
             if ($items === null) {
                 $descendant->clear();
             } else {
                 foreach ($items as $item) {
                     $val = $config->getPure($item);
                     if ($val instanceof Closure) {
                         continue;
                     }
                     $descendant->set($item, $val);
                 }
             }
             $this->repo->save($descendant);
         }
     }
 }