Author: david
Date: Wed Sep 9 16:23:00 2009
New Revision: 3209
Log:
Load plugin table maps when loading propel database maps. Allows loading
plugin fixture files.
Modified:
trunk/lib/vendor/symfony/lib/plugins/sfPropelPlugin/lib/vendor/propel/map/DatabaseMap.php
Modified:
trunk/lib/vendor/symfony/lib/plugins/sfPropelPlugin/lib/vendor/propel/map/DatabaseMap.php
==============================================================================
---
trunk/lib/vendor/symfony/lib/plugins/sfPropelPlugin/lib/vendor/propel/map/DatabaseMap.php
Wed Sep 9 13:39:16 2009 (r3208)
+++
trunk/lib/vendor/symfony/lib/plugins/sfPropelPlugin/lib/vendor/propel/map/DatabaseMap.php
Wed Sep 9 16:23:00 2009 (r3209)
@@ -62,25 +62,38 @@
public function __construct($name)
{
$this->name = $name;
+ $pluginMapDirs = array();
-$finder = sfFinder::type('file')->name('*.php');
-foreach ($finder->in(sfConfig::get('sf_lib_dir').'/model/map') as $path)
-{
- require_once $path;
-}
-
-foreach (get_declared_classes() as $className)
-{
- $class = new ReflectionClass($className);
- if ($class->implementsInterface('MapBuilder'))
- {
- $pattern = array('/MapBuilder$/', '/(.)([A-Z])/');
- $replacement = array(null, '\\1_\\2');
- $tableName = 'q_'.strtolower(preg_replace($pattern, $replacement,
$className));
-
- $this->addTableBuilder($tableName, new $className);
- }
-}
+ $finder = sfFinder::type('file')->name('*.php');
+
+ // Get directory names that contain table maps for plugins
+ foreach(ProjectConfiguration::getActive()->getPlugins() as $enabledPlugin)
+ {
+ $mapPath =
sfConfig::get('sf_plugins_dir').'/'.$enabledPlugin.'/lib/model/map/';
+ $maps = sfFinder::type('file')->name('*.php')->in($mapPath);
+ if (is_array($maps) && 0 < count($maps))
+ {
+ $pluginMapDirs[] = $mapPath;
+ }
+ }
+
+ foreach
($finder->in(array_merge(array(sfConfig::get('sf_lib_dir').'/model/map'),
$pluginMapDirs)) as $path)
+ {
+ require_once $path;
+ }
+
+ foreach (get_declared_classes() as $className)
+ {
+ $class = new ReflectionClass($className);
+ if ($class->implementsInterface('MapBuilder'))
+ {
+ $pattern = array('/MapBuilder$/', '/(.)([A-Z])/');
+ $replacement = array(null, '\\1_\\2');
+ $tableName = 'q_'.strtolower(preg_replace($pattern, $replacement,
$className));
+
+ $this->addTableBuilder($tableName, new $className);
+ }
+ }
}
/**
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Qubit Toolkit Commits" 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.ca/group/qubit-commits?hl=en
-~----------~----~----~----~------~----~------~--~---