[Doctrine] #1654: generate-migrations-models - Making models_path optional

1 view
Skip to first unread message

Doctrine

unread,
Nov 7, 2008, 10:12:43 AM11/7/08
to doctri...@googlegroups.com
#1654: generate-migrations-models - Making models_path optional
-----------------------------------+----------------------------------------
Reporter: deefour | Owner: jwage
Type: enhancement | Status: new
Priority: minor | Milestone: Unknown
Component: Tasks | Version: 1.1-DEV
Keywords: | Has_test: 0
Mystatus: Pending Core Response | Has_patch: 0
-----------------------------------+----------------------------------------
Hello-

I'm using:

* PHP 5.2.6
* Doctrine 1.1

It would be useful to make the models_path parameter for the
Doctrine_Task_GenerateMigrationsModels task optional;

Currently:
{{{
class Doctrine_Task_GenerateMigrationsModels extends Doctrine_Task
{
public $description = 'Generate migration classes for an
existing set of models',
$requiredArguments = array('migrations_path' => 'Specify
the path to your migration classes folder.',
'yaml_schema_path' => 'Specify
the path to your yaml schema files folder.'),
$optionalArguments = array('models_path' => 'Specify
the path to your doctrine models folder.');

// ...
}}}


Proposed:
{{{
class Doctrine_Task_GenerateMigrationsModels extends Doctrine_Task
{
public $description = 'Generate migration classes for an
existing set of models',
$requiredArguments = array('migrations_path' => 'Specify
the path to your migration classes folder.',
'yaml_schema_path' => 'Specify
the path to your yaml schema files folder.'),
$optionalArguments = array('models_path' => 'Specify
the path to your doctrine models folder.');

// ...
}}}


I have my models split into more than one directory, and as such I do this
prior to calling the Doctrine_Cli::run() in my CLI script

{{{
Doctrine::loadModels(array(CORE_PATH .'/php/model/',
APPLICATION_PATH .'/php/model/'));
}}}

Then I can execute the task only passing the Yaml schema directory and the
migrations destination directory to be used.

{{{
./doctrine generate-migrations-models _config/migrations _config/schemas
}}}

Manually loading my models prior to running the task makes specifying the
models_path parameter unnecessary. As previously mentioned, it is
necessary for me to pre-load the models since they are coming from more
than 1 directory.

--
Ticket URL: <http://trac.doctrine-project.org/ticket/1654>
Doctrine <http://www.phpdoctrine.org>
PHP Doctrine Object Relational Mapper

Doctrine

unread,
Nov 13, 2008, 6:21:17 PM11/13/08
to doctri...@googlegroups.com
#1654: generate-migrations-models - Making models_path optional
--------------------------+-------------------------------------------------
Reporter: deefour | Owner: jwage
Type: enhancement | Status: new
Priority: minor | Milestone: 1.1.0
Component: Tasks | Version: 1.1-DEV
Resolution: | Keywords:
Has_test: 0 | Mystatus: Pending Core Response
Has_patch: 0 |
--------------------------+-------------------------------------------------
Changes (by jwage):

* milestone: => 1.1.0

--
Ticket URL: <http://trac.doctrine-project.org/ticket/1654#comment:2>

Doctrine

unread,
Nov 13, 2008, 6:29:47 PM11/13/08
to doctri...@googlegroups.com
#1654: generate-migrations-models - Making models_path optional
--------------------------+-------------------------------------------------
Reporter: deefour | Owner: jwage
Type: enhancement | Status: new
Priority: minor | Milestone: 1.1.0
Component: Tasks | Version: 1.1-DEV
Resolution: | Keywords:
Has_test: 0 | Mystatus: Pending Core Response
Has_patch: 0 |
--------------------------+-------------------------------------------------
Comment (by deefour):

I think I submitted this ticket a bit prematurely. I made a post to the
forum looking for a bit more of a discussion from others before posting
here again but have yet to receive a response there.

http://www.doctrine-
project.org/forum/viewtopic.php?f=2&t=358&sid=52201610407b62b5cc4a78a0b789f679#p1218

In summary, I think it would be equally useful to allow for multiple
model_paths to be entered via the command line delimited by a single colon
':' character, as is common elsewhere outside of doctrine (think linux
$PATH).

--
Ticket URL: <http://trac.doctrine-project.org/ticket/1654#comment:3>

Doctrine

unread,
Dec 1, 2008, 2:51:43 PM12/1/08
to doctri...@googlegroups.com
#1654: generate-migrations-models - Making models_path optional
--------------------------+-------------------------------------------------
Reporter: deefour | Owner: jwage
Type: enhancement | Status: closed
Priority: minor | Milestone: 1.1.0
Component: Tasks | Version: 1.1-DEV
Resolution: fixed | Keywords:
Has_test: 0 | Mystatus: Pending Core Response
Has_patch: 0 |
--------------------------+-------------------------------------------------
Changes (by jwage):

* status: new => closed
* resolution: => fixed


Comment:

Fixed in r5226. To handle this properly we need to enhance the command
line task system to handle arguments and options properly.

--
Ticket URL: <http://trac.doctrine-project.org/ticket/1654#comment:4>

Doctrine

unread,
Dec 1, 2008, 4:35:29 PM12/1/08
to doctri...@googlegroups.com
#1654: generate-migrations-models - Making models_path optional
--------------------------+-------------------------------------------------
Reporter: deefour | Owner: jwage
Type: enhancement | Status: closed
Priority: minor | Milestone: 1.1.0
Component: Tasks | Version: 1.1-DEV
Resolution: fixed | Keywords:
Has_test: 0 | Mystatus: Pending Core Response
Has_patch: 0 |
--------------------------+-------------------------------------------------

Comment(by deefour):

Hi jonwage-

Can you let me know your thoughts on this a bit? I'd love to try to patch
this up with your vision in mind.


Maybe something like changing


{{{
./doctrine generate-yaml-models path/to/schema path/to/models
}}}


to


{{{
./doctrine generate-yaml-models --yaml-schema-path=path/to/schema
--models-path=path/to/models:2nd/path/to/models
}}}


And perhaps if you'd like the explicit arguments to be optional, they can
take precedence? ie.


{{{
./doctrine generate-yaml-models path/to/schema --yaml-schema-
path=other/path/to/schema
}}}


This would set the yaml_schema_path argument to `other/path/to/schema`,
overriding the implicit `path/to/schema` argument. I'm not sure it would
be best to mix implicit and explicit arguments though like this.

--
Ticket URL: <http://trac.doctrine-project.org/ticket/1654#comment:5>

Reply all
Reply to author
Forward
0 new messages