Example #1
0
 /**
  * Merge two Containers
  *
  * @todo   Handle duplicates, currently array_merge overwrites them
  * @param  Yadif_Container $container
  * @return Yadif_Container
  */
 public function merge(Yadif_Container $container)
 {
     $this->_container = array_merge($this->_container, $container->getContainer());
     $this->_instances = array_merge($this->_instances, $container->getInstances());
     $otherConfig = $container->getConfig();
     $ownConfig = $this->getConfig();
     if ($otherConfig instanceof Zend_Config) {
         if ($ownConfig == null) {
             $this->setConfig($otherConfig);
         } else {
             if ($ownConfig->readOnly() == true) {
                 $this->setConfig(new Zend_Config(array_merge($ownConfig->toArray(), $otherConfig->toArray())));
             } else {
                 $this->setConfig($ownConfig->merge($otherConfig));
             }
         }
     }
     return $this;
 }