public function execute()
 {
     Doctrine_Core::generateMigrationsFromModels($this->getArgument('migrations_path'), $this->getArgument('models_path'));
     $this->notify('Generated migration classes successfully from models');
 }
 public function generateMigration($className = null, $dFromDatabase = false, $mFromModels = false)
 {
     $this->_initDoctrineResource();
     $migratePath = $this->_getMigrationsDirectoryPath();
     if ($className) {
         Doctrine_Core::generateMigrationClass($className, $migratePath);
         $this->_print('Successfully generated migration class ' . $className . '.', array('color' => 'green'));
         $this->_print('Destination Directory: ' . $migratePath);
     } else {
         if ($dFromDatabase) {
             $yamlSchemaPath = $this->_getYamlDirectoryPath();
             $migration = new Doctrine_Migration($migrationsPath);
             $result1 = false;
             if (!count($migration->getMigrationClasses())) {
                 $result1 = Doctrine_Core::generateMigrationsFromDb($migrationsPath);
             }
             $connections = array();
             foreach (Doctrine_Manager::getInstance() as $connection) {
                 $connections[] = $connection->getName();
             }
             $changes = Doctrine_Core::generateMigrationsFromDiff($migrationsPath, $connections, $yamlSchemaPath);
             $numChanges = count($changes, true) - count($changes);
             $result = $result1 || $numChanges ? true : false;
             if ($result) {
                 $this->_print('Generated migration classes from the database successfully.');
             } else {
                 throw new Exception('Could not generate migration classes from database');
             }
         } else {
             if ($mFromModels) {
                 $this->_loadDoctrineModels();
                 Doctrine_Core::generateMigrationsFromModels($migrationsPath, null);
                 $this->_print('Generated migration classes from the model successfully.');
             }
         }
     }
 }