Doctrine 1
  1. Doctrine 1
  2. DC-935

Doctrine_Task_BuildAllReload does not call generate-models-from-yaml

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major 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 = )

        Activity

        Hide
        Brandon Evans added a comment -

        Added the proper proposed code this time and also attached patch with better naming.

        Show
        Brandon Evans added a comment - Added the proper proposed code this time and also attached patch with better naming.

          People

          • Assignee:
            Jonathan H. Wage
            Reporter:
            Brandon Evans
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: