Details
-
Type:
Bug
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: 1.2.3
-
Fix Version/s: None
-
Component/s: Cli
-
Labels:None
-
Environment:Windows Vista 32bit, Apache 2.2.14, PHP 5.3.1
Description
Doctrine_Task_BuildAllReload never calls generate models-from-yaml. This does not coincide with the logic of Doctrine_Task_BuildAll and Doctrine_Task_BuildAllLoad.
BuildAllReload suggests that it will be building all (everything) and then reloading the database.
But instead it only rebuilds the database and loads data
Doctrine 1.2.3 - BuildAllReload.php
public function __construct($dispatcher = null) { parent::__construct($dispatcher); $this->rebuildDb = new Doctrine_Task_RebuildDb($this->dispatcher); $this->loadData = new Doctrine_Task_LoadData($this->dispatcher); $this->requiredArguments = array_merge($this->requiredArguments, $this->rebuildDb->requiredArguments, $this->loadData->requiredArguments); $this->optionalArguments = array_merge($this->optionalArguments, $this->rebuildDb->optionalArguments, $this->loadData->optionalArguments); } public function execute() { $this->rebuildDb->setArguments($this->getArguments()); $this->rebuildDb->execute(); $this->loadData->setArguments($this->getArguments()); $this->loadData->execute(); }
Instead, I think it would be more efficient and understanding to follow the same logic as build-all and build-all-load by calling drop-db and build-all-load.
Proposed - BuildAllReload.php
public function __construct($dispatcher = null) { parent::__construct($dispatcher); $this->dropDb = new Doctrine_Task_DropDb($this->dispatcher); $this->buildAllLoad = new Doctrine_Task_BuildAllLoad($this->dispatcher); $this->requiredArguments = array_merge($this->requiredArguments, $this->dropDb->requiredArguments, $this->buildAllLoad->requiredArguments); $this->optionalArguments = array_merge($this->optionalArguments, $this->dropDb->optionalArguments, $this->buildAllLoad->optionalArguments); } public function execute() { $this->dropDb->setArguments($this->getArguments()); $this->dropDb->execute(); $this->buildAllLoad->setArguments($this->getArguments()); $this->buildAllLoad->execute(); }
I attached a patch with the above changes... I got a little lost in the test area for Doctrine_CLI, so that is not included = )
Added the proper proposed code this time and also attached patch with better naming.