Author: Kris.Wallsmith
Date: 2010-02-08 20:02:44 +0100 (Mon, 08 Feb 2010)
New Revision: 27750
Modified:
branches/1.3/lib/task/generator/sfGenerateTaskTask.class.php
branches/1.4/lib/task/generator/sfGenerateTaskTask.class.php
Log:
[1.3, 1.4] updated generated stub task to guess a default connection name based
on ORM (closes #8209)
Modified: branches/1.3/lib/task/generator/sfGenerateTaskTask.class.php
===================================================================
--- branches/1.3/lib/task/generator/sfGenerateTaskTask.class.php
2010-02-08 18:48:39 UTC (rev 27749)
+++ branches/1.3/lib/task/generator/sfGenerateTaskTask.class.php
2010-02-08 19:02:44 UTC (rev 27750)
@@ -28,7 +28,7 @@
$this->addOptions(array(
new sfCommandOption('dir', null, sfCommandOption::PARAMETER_REQUIRED,
'The directory to create the task in', 'lib/task'),
- new sfCommandOption('use-database', null,
sfCommandOption::PARAMETER_REQUIRED, 'Whether the task needs model
initialization to access database', 'doctrine'),
+ new sfCommandOption('use-database', null,
sfCommandOption::PARAMETER_REQUIRED, 'Whether the task needs model
initialization to access database', sfConfig::get('sf_orm')),
new sfCommandOption('brief-description', null,
sfCommandOption::PARAMETER_REQUIRED, 'A brief task description (appears in task
list)'),
));
@@ -93,7 +93,7 @@
HED;
$useDatabase = sfToolkit::literalize($options['use-database']);
- $defaultConnection = is_string($useDatabase) ? $useDatabase : 'doctrine';
+ $defaultConnection = is_string($useDatabase) ? $useDatabase :
sfConfig::get('sf_orm');
if ($useDatabase)
{
@@ -128,7 +128,7 @@
{
// initialize the database connection
\$databaseManager = new sfDatabaseManager(\$this->configuration);
- \$connection = \$databaseManager->getDatabase(\$options['connection'] ?
\$options['connection'] : null)->getConnection();
+ \$connection =
\$databaseManager->getDatabase(\$options['connection'])->getConnection();
// add your code here
}
Modified: branches/1.4/lib/task/generator/sfGenerateTaskTask.class.php
===================================================================
--- branches/1.4/lib/task/generator/sfGenerateTaskTask.class.php
2010-02-08 18:48:39 UTC (rev 27749)
+++ branches/1.4/lib/task/generator/sfGenerateTaskTask.class.php
2010-02-08 19:02:44 UTC (rev 27750)
@@ -28,7 +28,7 @@
$this->addOptions(array(
new sfCommandOption('dir', null, sfCommandOption::PARAMETER_REQUIRED,
'The directory to create the task in', 'lib/task'),
- new sfCommandOption('use-database', null,
sfCommandOption::PARAMETER_REQUIRED, 'Whether the task needs model
initialization to access database', 'doctrine'),
+ new sfCommandOption('use-database', null,
sfCommandOption::PARAMETER_REQUIRED, 'Whether the task needs model
initialization to access database', sfConfig::get('sf_orm')),
new sfCommandOption('brief-description', null,
sfCommandOption::PARAMETER_REQUIRED, 'A brief task description (appears in task
list)'),
));
@@ -93,7 +93,7 @@
HED;
$useDatabase = sfToolkit::literalize($options['use-database']);
- $defaultConnection = is_string($useDatabase) ? $useDatabase : 'doctrine';
+ $defaultConnection = is_string($useDatabase) ? $useDatabase :
sfConfig::get('sf_orm');
if ($useDatabase)
{
@@ -128,7 +128,7 @@
{
// initialize the database connection
\$databaseManager = new sfDatabaseManager(\$this->configuration);
- \$connection = \$databaseManager->getDatabase(\$options['connection'] ?
\$options['connection'] : null)->getConnection();
+ \$connection =
\$databaseManager->getDatabase(\$options['connection'])->getConnection();
// add your code here
}
--
You received this message because you are subscribed to the Google Groups
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/symfony-svn?hl=en.