Ejemplo n.º 1
0
 /**
  * Test case
  */
 public function testSetExtendsString()
 {
     $config = new Enlight_Config(array());
     $config->setSection('test');
     $config->setExtends('default');
     $testExtends = array('test' => 'default');
     $this->assertEquals($testExtends, $config->getExtends());
 }
Ejemplo n.º 2
0
 /**
  * Reads a section from the data store.
  *
  * @param      Enlight_Config $config
  * @return     Enlight_Config_Adapter_DbTable
  */
 public function read(Enlight_Config $config)
 {
     $name = $this->_namePrefix . $config->getName() . $this->_nameSuffix;
     $section = $config->getSection();
     $data = array();
     $extends = $config->getExtends();
     $currentSection = is_array($section) ? implode(':', $section) : $section;
     while ($currentSection !== null) {
         $data = array_merge($this->readSection($name, $currentSection), $data);
         $currentSection = isset($extends[$currentSection]) ? $extends[$currentSection] : null;
     }
     $config->setData($data);
     return $this;
 }