本文整理汇总了PHP中Propel\Generator\Model\Database::getTablesForSql方法的典型用法代码示例。如果您正苦于以下问题:PHP Database::getTablesForSql方法的具体用法?PHP Database::getTablesForSql怎么用?PHP Database::getTablesForSql使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Propel\Generator\Model\Database
的用法示例。
在下文中一共展示了Database::getTablesForSql方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAddTablesDDL
/**
* Returns the DDL SQL to add the tables of a database
* together with index and foreign keys.
* Since MSSQL always checks it the tables in foreign key definitions exist,
* the foreign key DDLs are moved after all tables are created
*
* @return string
*/
public function getAddTablesDDL(Database $database)
{
$ret = $this->getBeginDDL();
foreach ($database->getTablesForSql() as $table) {
$this->normalizeTable($table);
}
foreach ($database->getTablesForSql() as $table) {
$ret .= $this->getCommentBlockDDL($table->getName());
$ret .= $this->getDropTableDDL($table);
$ret .= $this->getAddTableDDL($table);
$ret .= $this->getAddIndicesDDL($table);
}
foreach ($database->getTablesForSql() as $table) {
$ret .= $this->getAddForeignKeysDDL($table);
}
$ret .= $this->getEndDDL();
return $ret;
}
示例2: getAddTablesDDL
public function getAddTablesDDL(Database $database)
{
$ret = '';
foreach ($database->getTablesForSql() as $table) {
$ret .= $this->getCommentBlockDDL($table->getName());
$ret .= $this->getDropTableDDL($table);
$ret .= $this->getAddTableDDL($table);
}
if ($ret) {
$ret = $this->getBeginDDL() . $ret . $this->getEndDDL();
}
return $ret;
}
示例3: getAddTablesDDL
/**
* {@inheritdoc}
*/
public function getAddTablesDDL(Database $database)
{
$ret = '';
foreach ($database->getTablesForSql() as $table) {
$this->checkTable($table);
}
foreach ($database->getTablesForSql() as $table) {
$ret .= $this->getCommentBlockDDL($table->getName());
$ret .= $this->getDropTableDDL($table);
$ret .= $this->getAddTableDDL($table);
$ret .= $this->getAddIndicesDDL($table);
}
return $ret;
}
示例4: getWarnings
public function getWarnings(Database $database, PropelPlatformInterface $platform)
{
foreach ($database->getTablesForSql() as $table) {
foreach ($table->getForeignKeys() as $fk) {
if ($platform instanceof MssqlPlatform && $fk->hasOnUpdate() && $fk->getOnUpdate() == ForeignKey::SETNULL) {
// there may be others that also won't work
// we have to skip this because it's unsupported.
$this->log(sprintf('Ignoring the "ON UPDATE SET NULL" option for "%s" fk on "%s" table (unsupported by MSSQL).', $fk->getLocalColumnNames(), $table->getName()), Project::MSG_WARN);
}
if ($platform instanceof MssqlPlatform && $fk->hasOnDelete() && $fk->getOnDelete() == ForeignKey::SETNULL) {
// there may be others that also won't work
// we have to skip this because it's unsupported.
$this->log(sprintf('Ignoring the "ON DELETE SET NULL" option for "%s" fk on "%s" table (unsupported by MSSQL).', $fk->getLocalColumnNames(), $table->getName()), Project::MSG_WARN);
}
if ($platform instanceof OraclePlatform && $fk->hasOnUpdate()) {
// there may be others that also won't work
// we have to skip this because it's unsupported.
$this->log(sprintf('Ignoring the "ON UPDATE" option for "%s" fk on "%s" table (unsupported by current Oracle adapter).', $fk->getLocalColumnNames(), $table->getName()), Project::MSG_WARN);
}
}
}
}
示例5: testAddArrayTable
public function testAddArrayTable()
{
$database = new Database();
$database->addTable(['name' => 'books']);
$database->addTable(['name' => 'authors']);
$database->addTable(['name' => 'categories', 'skipSql' => 'true']);
$database->addTable(['name' => 'publishers', 'readOnly' => 'true']);
$this->assertTrue($database->hasTable('books'));
$this->assertTrue($database->hasTable('books', true));
$this->assertFalse($database->hasTable('BOOKS'));
$this->assertTrue($database->hasTableByPhpName('Books'));
$this->assertInstanceOf('Propel\\Generator\\Model\\Table', $database->getTable('books'));
$this->assertInstanceOf('Propel\\Generator\\Model\\Table', $database->getTableByPhpName('Books'));
// 3 tables because read only table is excluded from the count
$this->assertSame(3, $database->countTables());
// 3 tables because skipped sql table is excluded from the count
$this->assertCount(3, $database->getTablesForSql());
}