本文整理汇总了PHP中Doctrine\ORM\Tools\SchemaTool::getAllMetadata方法的典型用法代码示例。如果您正苦于以下问题:PHP SchemaTool::getAllMetadata方法的具体用法?PHP SchemaTool::getAllMetadata怎么用?PHP SchemaTool::getAllMetadata使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine\ORM\Tools\SchemaTool
的用法示例。
在下文中一共展示了SchemaTool::getAllMetadata方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fire
/**
* Execute the console command.
*
* @return void
*/
public function fire()
{
if ($this->option('sql')) {
$this->info('Outputting create query:');
$sql = $this->tool->getCreateSchemaSql($this->metadata->getAllMetadata());
$this->info(implode(';' . PHP_EOL, $sql));
} else {
$this->info('Creating database schema...');
$this->tool->createSchema($this->metadata->getAllMetadata());
$this->info('Schema has been created!');
}
}
示例2: fire
/**
* Execute the console command.
*
* @return void
*/
public function fire()
{
$sql = $this->tool->getDropSchemaSQL($this->metadata->getAllMetadata());
if (empty($sql)) {
$this->info('Current models do not exist in schema.');
return;
}
if ($this->option('sql')) {
$this->info('Outputting drop query:');
$this->info(implode(';' . PHP_EOL, $sql));
} else {
$this->info('Dropping database schema....');
$this->tool->dropSchema($this->metadata->getAllMetadata());
$this->info('Schema has been dropped!');
}
}
示例3: fire
public function fire()
{
if ($this->option('sql')) {
$this->info('Outputting create query:' . PHP_EOL);
$sql = $this->tool->getCreateSchemaSql($this->metadata->getAllMetadata());
$this->info(implode(';' . PHP_EOL, $sql) . ';');
} else {
if ($this->option('commit')) {
$this->info('Creating database schema...');
$this->tool->createSchema($this->metadata->getAllMetadata());
$this->info('Schema has been created!');
} else {
$this->comment("Warning: this command can cause data loss. Run with --sql or --commit.");
}
}
}
示例4: fire
/**
* Execute the console command.
*
* @return void
*/
public function fire()
{
$this->info('Checking if database needs updating....');
$clean = $this->option('clean');
$sql = $this->tool->getUpdateSchemaSql($this->metadata->getAllMetadata(), !$clean);
if (empty($sql)) {
$this->info('No updates found.');
return;
}
if ($this->option('sql')) {
$this->info('Outputting update query:');
$this->info(implode(';' . PHP_EOL, $sql));
} else {
$this->info('Updating database schema....');
$this->tool->updateSchema($this->metadata->getAllMetadata(), !$clean);
$this->info('Schema has been updated!');
}
}
示例5: fire
public function fire()
{
$sql = $this->tool->getDropSchemaSQL($this->metadata->getAllMetadata());
if (empty($sql)) {
$this->error('Current models do not exist in schema.');
return;
}
if ($this->option('sql')) {
$this->info('Outputting drop query:' . PHP_EOL);
$this->line(implode(';' . PHP_EOL, $sql) . ';');
} else {
if ($this->option('commit')) {
$this->info('Dropping database schema....');
$this->tool->dropSchema($this->metadata->getAllMetadata());
$this->info('Schema has been dropped!');
} else {
$this->comment("Warning: this command can cause data loss. Run with --sql or --commit.");
}
}
}
示例6: fire
public function fire()
{
$this->info('Checking if database needs updating....');
$sql = $this->tool->getUpdateSchemaSql($this->metadata->getAllMetadata(), $this->option('clean'));
if (empty($sql)) {
$this->info('No updates found.');
return;
}
if ($this->option('sql')) {
$this->info('Outputting update query:');
$this->info(implode(';' . PHP_EOL, $sql) . ';');
} else {
if ($this->option('commit')) {
$this->info('Updating database schema....');
$this->tool->updateSchema($this->metadata->getAllMetadata());
$this->info('Schema has been updated!');
} else {
$this->comment("Warning: this command can cause data loss. Run with --sql or --commit.");
}
}
}