Created
October 23, 2009 15:40
-
-
Save kriswallsmith/216986 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// copy schema files to tmp directory and apply default behaviors there | |
$tmpDir = sys_get_temp_dir().'sf_propel_plugin/phingproj_'.time().'_'.rand(11111, 99999); | |
$this->getFilesystem()->mkdirs($tmpDir); | |
$this->getFilesystem()->copy(sfConfig::get('sf_config_dir').'/propel.ini', $tmpDir.'/propel.ini'); | |
$buildProperties = new Properties(); | |
$buildProperties->load(new PhingFile($tmpDir.'/propel.ini')); | |
$finder = sfFinder::type('file')->name('*schema.xml')->follow_link(); | |
foreach ($finder->in(sfConfig::get('sf_config_dir')) as $source) | |
{ | |
$target = $tmpDir.'/'.basename($source); | |
$database = new SimpleXMLElement($source, null, true); | |
$behaviors = $this->getBehaviors($database); | |
foreach ($database->table as $table) | |
{ | |
$this->addDefaultBehaviors($table, $behaviors, $buildProperties); | |
} | |
$this->logSection('file+', $target); | |
file_put_contents($target, $database->asXml()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment