本文整理匯總了PHP中Doctrine::generateSqlFromModels方法的典型用法代碼示例。如果您正苦於以下問題:PHP Doctrine::generateSqlFromModels方法的具體用法?PHP Doctrine::generateSqlFromModels怎麽用?PHP Doctrine::generateSqlFromModels使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Doctrine
的用法示例。
在下文中一共展示了Doctrine::generateSqlFromModels方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: main
/**
* Main entry point for task
*/
public function main()
{
$conn = Doctrine_Manager::connection($this->_dsn->_toString());
$conn->setAttribute('portability', Doctrine::PORTABILITY_ALL);
$conn->setAttribute(Doctrine::ATTR_QUOTE_IDENTIFIER, true);
Doctrine_Manager::getInstance()->setAttribute(Doctrine::ATTR_MODEL_LOADING, Doctrine::MODEL_LOADING_AGGRESSIVE);
$sql = Doctrine::generateSqlFromModels($this->_dir);
$this->writeFile($sql);
}
示例2: doctrineAction
public function doctrineAction()
{
$options = array('phpDocPackage' => 'Kromatick', 'phpDocSubpackage' => 'Intermodels', 'phpDocName' => 'Neozeratul', 'phpDocEmail' => 'neozeratul@gmail.com');
Doctrine::dropDatabases();
Doctrine::createDatabases();
Doctrine::generateModelsFromYaml(APPLICATION_PATH . "/data/schema/schema.yml", APPLICATION_PATH . "/models", $options);
Doctrine::createTablesFromModels();
//Doctrine::loadData($yamlPath, $append):
echo Doctrine::generateSqlFromModels();
$this->render('index');
}
示例3: execute
public function execute()
{
if (is_dir($this->getArgument('sql_path'))) {
$path = $this->getArgument('sql_path') . DIRECTORY_SEPARATOR . 'schema.sql';
} else {
if (is_file($this->getArgument('sql_path'))) {
$path = $this->getArgument('sql_path');
} else {
throw new Doctrine_Task_Exception('Invalid sql path.');
}
}
$sql = Doctrine::generateSqlFromModels($this->getArgument('models_path'));
file_put_contents($path, $sql);
$this->notify('Generated SQL successfully for models');
}