function run_propel_build_sql_diff($task, $args)
{
    if (!count($args)) {
        throw new Exception('You must provide the application.');
    }
    $app = $args[0];
    if (!is_dir(sfConfig::get('sf_app_dir') . DIRECTORY_SEPARATOR . $app)) {
        throw new Exception(sprintf('The app "%s" does not exist.', $app));
    }
    run_propel_build_sql($task, $args);
    pake_echo_action('propel-sql-diff', "building database patch");
    define('SF_ROOT_DIR', realpath(dirname(__FILE__) . '/../../../..'));
    define('SF_APP', $app);
    define('SF_ENVIRONMENT', isset($args[1]) ? $args[1] : 'dev');
    define('SF_DEBUG', 1);
    require_once SF_ROOT_DIR . DIRECTORY_SEPARATOR . 'apps' . DIRECTORY_SEPARATOR . SF_APP . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'config.php';
    $databaseManager = new sfDatabaseManager();
    $databaseManager->initialize();
    $i = new dbInfo();
    $i->loadFromDb();
    $i2 = new dbInfo();
    $i2->loadAllFilesInDir(sfConfig::get('sf_data_dir') . '/sql');
    $diff = $i->getDiffWith($i2);
    $filename = sfConfig::get('sf_data_dir') . '/sql/diff.sql';
    if ($diff == '') {
        pake_echo_comment("no difference found");
    }
    pake_echo_action('propel-sql-diff', "writing file {$filename}");
    file_put_contents($filename, $diff);
}
 /**
  * @see sfTask
  */
 protected function execute($arguments = array(), $options = array())
 {
     $buildSql = new sfPropelBuildSqlTask($this->dispatcher, $this->formatter);
     $buildSql->setCommandApplication($this->commandApplication);
     $buildSql->run();
     $this->logSection("propel-diff", "building database patch");
     $configuration = ProjectConfiguration::getApplicationConfiguration($arguments['application'], $options['env'], true);
     $databaseManager = new sfDatabaseManager($configuration);
     $i = new dbInfo();
     $i->loadFromDb();
     $i2 = new dbInfo();
     $i2->loadAllFilesInDir(sfConfig::get('sf_data_dir') . '/sql');
     $diff = $i->getDiffWith($i2);
     $filename = sfConfig::get('sf_data_dir') . '/sql/diff.sql';
     if ($diff == '') {
         $this->logSection("propel-diff", "no difference found");
     }
     $this->logSection('propel-sql-diff', "writing file {$filename}");
     file_put_contents($filename, $diff);
 }