Development

Changeset 7778

You must first sign up to be able to contribute.

Changeset 7778

Show
Ignore:
Timestamp:
03/08/08 14:43:55 (6 months ago)
Author:
fabien
Message:

moved task registration to sfCommandApplication

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.1/lib/command/sfCommandApplication.class.php

    r7467 r7778  
    4949 
    5050    $this->configure(); 
     51 
     52    $this->registerTasks(); 
    5153  } 
    5254 
     
    8183   * Registers an array of task objects. 
    8284   * 
     85   * If you pass null, this method will register all available tasks. 
     86   * 
    8387   * @param array An array of tasks 
    8488   */ 
    85   public function registerTasks($tasks) 
    86   { 
     89  public function registerTasks($tasks = null) 
     90  { 
     91    if (is_null($tasks)) 
     92    { 
     93      $tasks = array(); 
     94      foreach (get_declared_classes() as $class) 
     95      { 
     96        $r = new Reflectionclass($class); 
     97        if ($r->isSubclassOf('sfTask') && !$r->isAbstract()) 
     98        { 
     99          $tasks[] = new $class($this->dispatcher, $this->formatter); 
     100        } 
     101      } 
     102    } 
     103 
    87104    foreach ($tasks as $task) 
    88105    { 
  • branches/1.1/lib/command/sfSymfonyCommandApplication.class.php

    r7614 r7778  
    3737    $this->setVersion(SYMFONY_VERSION); 
    3838 
    39     $this->initializeTasks(); 
     39    $this->loadTasks(); 
    4040  } 
    4141 
     
    7575   * Looks for tasks in the symfony core, the current project and all project plugins. 
    7676   */ 
    77   protected function initializeTasks() 
     77  protected function loadTasks() 
    7878  { 
    7979    $dirs = array( 
     
    9797      } 
    9898    } 
    99  
    100     foreach (get_declared_classes() as $class) 
    101     { 
    102       $r = new Reflectionclass($class); 
    103       if ($r->isSubclassOf('sfTask') && !$r->isAbstract()) 
    104       { 
    105         $this->registerTask(new $class($this->dispatcher, $this->formatter)); 
    106       } 
    107     } 
    10899  } 
    109100