本文整理匯總了PHP中Propel\Generator\Model\Database::setAppData方法的典型用法代碼示例。如果您正苦於以下問題:PHP Database::setAppData方法的具體用法?PHP Database::setAppData怎麽用?PHP Database::setAppData使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Propel\Generator\Model\Database
的用法示例。
在下文中一共展示了Database::setAppData方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testAppendXmlNamespaceWithAutoPackage
public function testAppendXmlNamespaceWithAutoPackage()
{
$schema = <<<EOF
<?xml version="1.0"?>
<table name="test" namespace="\\testNs"/>
EOF;
$doc = new DOMDocument('1.0');
$doc->formatOutput = true;
$config = new GeneratorConfig();
$config->setBuildProperties(array('propel.namespace.autoPackage' => 'true'));
$appData = new AppData();
$appData->setGeneratorConfig($config);
$db = new Database('testDb');
$db->setAppData($appData);
$table = new Table('test');
$table->setDatabase($db);
$table->setNamespace('\\testNs');
$table->appendXml($doc);
$xmlstr = trim($doc->saveXML());
$this->assertSame($schema, $xmlstr);
$schema = <<<EOF
<?xml version="1.0"?>
<table name="test" namespace="\\testNs" package="testPkg"/>
EOF;
$doc = new DOMDocument('1.0');
$doc->formatOutput = true;
$table->setPackage('testPkg');
$table->appendXml($doc);
$xmlstr = trim($doc->saveXML());
$this->assertSame($schema, $xmlstr);
}
示例2: addDatabase
/**
* Add a database to the list and sets the AppData property to this
* AppData
*
* @param db the database to add
*/
public function addDatabase($db)
{
if ($db instanceof Database) {
$db->setAppData($this);
if ($db->getPlatform() === null) {
if ($config = $this->getGeneratorConfig()) {
$pf = $config->getConfiguredPlatform(null, $db->getName());
$db->setPlatform($pf ? $pf : $this->platform);
} else {
$db->setPlatform($this->platform);
}
}
$this->dbList[] = $db;
return $db;
} else {
// XML attributes array / hash
$d = new Database();
$d->setAppData($this);
$d->loadFromXML($db);
return $this->addDatabase($d);
// calls self w/ different param type
}
}