Uploaded image for project: 'Doctrine 1'
  1. Doctrine 1
  2. DC-78

Doctrine_Cli: tests and refactorings


    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.1.4
    • Fix Version/s: 1.2.0-ALPHA3
    • Component/s: Cli
    • Labels:
    • Environment:
      Darwin, PHP 5.3, MacBook


      I'm a fan of the CLI and tasks in Doctrine, but I recently had some trouble registering custom tasks.

      Having spent a good while refactoring this weekend, I understand that you can load additional tasks from a particular directory. Unfortunately, the tasks in said directory must follow the Doctrine naming conventions (i.e. they must start "Doctrine_Task").

      I'm using Doctrine 1.1.4 on PHP 5.3 and am using namespaces. Ideally, then, I don't want to have to follow the Doctrine naming conventions: I want to be able to use my own.

      Here's an example of what I can now do with my patched version:

      $cli = new Doctrine_Cli($config);
      $cli->registerTask('sakura\installer\doctrine\GenerateModelsDb', 'sakura-generate-models-db');

      I have also implemented a public loadAndRegisterTask() method that will load a specified file and then register a class.

      In refactoring Doctrine_Cli, I've written a test case, Doctrine_Cli_TestCase, which reasonably thoroughly tests the new and some of the old functionality. There's still scope for some more refactoring and testing, but I've got what I need for now.

      The enclosed patch was created against the 1.1.4 tag.

      Best regards


        There are no comments yet on this issue.


          • Assignee:
            jwage Jonathan H. Wage
            danbettles Dan Bettles
          • Votes:
            0 Vote for this issue
            1 Start watching this issue


            • Created: