本文整理汇总了PHP中Propel::setDatabaseMap方法的典型用法代码示例。如果您正苦于以下问题:PHP Propel::setDatabaseMap方法的具体用法?PHP Propel::setDatabaseMap怎么用?PHP Propel::setDatabaseMap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Propel
的用法示例。
在下文中一共展示了Propel::setDatabaseMap方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: resetDatabaseMap
/**
* Clears and repopulates the DatabaseMap with new TableMap classes
*
* @param type $name
* @param type $tableMapClassNames
*/
protected function resetDatabaseMap($name, array $tableMapClassNames)
{
$dbMap = new DatabaseMap($name);
foreach ($tableMapClassNames as $tableMapClassName) {
$dbMap->addTableFromMapClass($tableMapClassName);
}
Propel::setDatabaseMap($name, $dbMap);
}
示例2: loadMapBuilders
/**
* Loads all map builders for a given connection name
*
* Use sfFileCache to cache propel databaseMap
*
* @throws sfException If the class cannot be found
*/
protected function loadMapBuilders($connectionName)
{
$cacheKey = 'dbMap-' . $connectionName;
if (!($dbMap = $this->cache->get($cacheKey))) {
$dbMap = Propel::getDatabaseMap();
$files = sfFinder::type('file')->name('*TableMap.php')->in(sfProjectConfiguration::getActive()->getModelDirs());
foreach ($files as $file) {
$omClass = basename($file, 'TableMap.php');
if (class_exists($omClass) && is_subclass_of($omClass, 'BaseObject') && constant($omClass . 'Peer::DATABASE_NAME') == $connectionName) {
$tableMapClass = basename($file, '.php');
$dbMap->addTableFromMapClass($tableMapClass);
}
}
$dbMap = serialize($dbMap);
$this->cache->set($cacheKey, $dbMap, $this->cacheKeepDuration);
}
Propel::setDatabaseMap($connectionName, unserialize($dbMap));
}