Hi everyone,
I'm using symfony 1.3 with a current checkout and think that I just
found a bug in the migration tasks of sfDoctrinePlugin. While running
the "./symfony doctrine:generate-migrations-models" task I get this
error:
Fatal error: Call to a member function getTableName() on a non-object
in
[...]/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Migration/Builder.php
on line 304
After some digging I found out that the constructor of Builder.php
does the following:
public function __construct($migrationsPath = null)
{
if ($migrationsPath instanceof Doctrine_Migration) {
$this->setMigrationsPath($migrationsPath->getMigrationClassesDirectory());
$this->migration = $migrationsPath;
} else if (is_dir($migrationsPath)) {
$this->setMigrationsPath($migrationsPath);
$this->migration = new Doctrine_Migration($migrationsPath);
}
$this->loadTemplate();
}
So if the variable $migrationsPath is set to null (which is my case,
because I don't have the lib/migration/doctrine library yet), nothing
will happen and the method invocation
"$this->migration->getTableName()" on line 304 won't work, because
"$this->migration" is no object.
The root of this problem seems to be the task
"doctrine:generate-migrations-models" itself. Taking a look inside you
can see that it doesn't create the directory lib/migration/doctrine if
it's not there yet. If I create the directory by myself the task runs
smooth and everything is fine.
I was curious and also took a look into the code of
"doctrine:generate-migration" which uses this code:
$config = $this->getCliConfig();
[...]
if (!is_dir($config['migrations_path']))
{
$this->getFilesystem()->mkdirs($config['migrations_path']);
}
[...]
So it seems to me that this code is missing in the
"doctrine:generate-migrations-models" task.
Hope you got all information you need.
- Dennis
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"symfony developers" 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-devs?hl=en
-~----------~----~----~----~------~----~------~--~---