Example #1
0
 /**
  * Load the configuration group for the key from files and merge with data from DB.
  *
  * @param  string $group
  * @param  string $namespace
  * @param  string $collection
  *
  * @return void
  */
 protected function load($group, $namespace, $collection)
 {
     $env = $this->environment;
     // If we've already loaded this collection, we will just bail out since we do
     // not want to load it again. Once items are loaded a first time they will
     // stay kept in memory within this class and not loaded from disk again.
     if (isset($this->items[$collection])) {
         return;
     }
     //load items from DB
     $items = $this->dbProvider->load($collection, $env);
     // If we've already loaded this collection, we will just bail out since we do
     // not want to load it again. Once items are loaded a first time they will
     // stay kept in memory within this class and not loaded from disk again.
     $this->afterLoad = $this->origConfig->getAfterLoadCallbacks();
     if (isset($this->afterLoad[$namespace])) {
         $items = $this->callAfterLoad($namespace, $group, $items);
     }
     $this->items[$collection] = $items;
 }
Example #2
0
 /**
  * @param $origConfig
  * @param DbProviderInterface $dbProvider
  */
 public function __construct($origConfig, DbProviderInterface $dbProvider)
 {
     $this->dbProvider = $dbProvider;
     $this->origConfig = $origConfig;
     $this->items = $this->dbProvider->load();
 }