Просмотр исходного кода

ZF-11349
Zend_Tool
Zend Tool's DbAdapter should allow overwriting of existing options such as DbTable does


git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@24026 44c647ce-9c0f-0410-b52a-842ac1e357ba

adamlundrigan 14 лет назад
Родитель
Сommit
09234051e6
1 измененных файлов с 4 добавлено и 2 удалено
  1. 4 2
      library/Zend/Tool/Project/Provider/DbAdapter.php

+ 4 - 2
library/Zend/Tool/Project/Provider/DbAdapter.php

@@ -47,7 +47,7 @@ class Zend_Tool_Project_Provider_DbAdapter
 
     protected $_sectionName = 'production';
 
-    public function configure($dsn = null, /* $interactivelyPrompt = false, */ $sectionName = 'production')
+    public function configure($dsn = null, /* $interactivelyPrompt = false, */ $sectionName = 'production', $forceOverwrite = false)
     {
         $profile = $this->_loadProfile(self::NO_PROFILE_THROW_EXCEPTION);
 
@@ -69,7 +69,9 @@ class Zend_Tool_Project_Provider_DbAdapter
             throw new Zend_Tool_Project_Exception('The config does not have a ' . $this->_sectionName . ' section.');
         }
 
-        if (isset($this->_config->{$this->_sectionName}->resources->db)) {
+        if (isset($this->_config->{$this->_sectionName}->resources->db) && $forceOverwrite === true) {
+            unset($this->_config->{$this->_sectionName}->resources->db);
+        } else {
             throw new Zend_Tool_Project_Exception('The config already has a db resource configured in section ' . $this->_sectionName . '.');
         }