本文整理汇总了PHP中Doctrine\DBAL\Schema\Table::getOption方法的典型用法代码示例。如果您正苦于以下问题:PHP Table::getOption方法的具体用法?PHP Table::getOption怎么用?PHP Table::getOption使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine\DBAL\Schema\Table
的用法示例。
在下文中一共展示了Table::getOption方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadMetadataForTable
/**
* Load the metadata for a table.
*
* @param Table $table
*/
protected function loadMetadataForTable(Table $table)
{
$tblName = $table->getName();
if (isset($this->defaultAliases[$tblName])) {
$className = $this->defaultAliases[$tblName];
} else {
$className = $tblName;
$this->unmapped[] = $tblName;
}
$contentKey = $table->getOption('alias');
$this->metadata[$className] = [];
$this->metadata[$className]['identifier'] = $table->getPrimaryKey();
$this->metadata[$className]['table'] = $table->getName();
$this->metadata[$className]['boltname'] = $contentKey;
foreach ($table->getColumns() as $colName => $column) {
$mapping = ['fieldname' => $column->getName(), 'type' => $column->getType()->getName(), 'fieldtype' => $this->getFieldTypeFor($table->getOption('alias'), $column), 'length' => $column->getLength(), 'nullable' => $column->getNotnull(), 'platformOptions' => $column->getPlatformOptions(), 'precision' => $column->getPrecision(), 'scale' => $column->getScale(), 'default' => $column->getDefault(), 'columnDefinition' => $column->getColumnDefinition(), 'autoincrement' => $column->getAutoincrement()];
$this->metadata[$className]['fields'][$colName] = $mapping;
if (isset($this->contenttypes[$contentKey]['fields'][$colName])) {
$this->metadata[$className]['fields'][$colName]['data'] = $this->contenttypes[$contentKey]['fields'][$colName];
}
}
// This loop checks the contenttypes definition for any non-db fields and adds them.
if ($contentKey) {
$this->setRelations($contentKey, $className, $table);
$this->setIncomingRelations($contentKey, $className);
$this->setTaxonomies($contentKey, $className, $table);
$this->setTemplatefields($contentKey, $className, $table);
$this->setRepeaters($contentKey, $className, $table);
}
foreach ($this->getAliases() as $alias => $table) {
if (array_key_exists($table, $this->metadata)) {
$this->metadata[$alias] = $this->metadata[$table];
}
}
}
示例2: testBuilderOptions
public function testBuilderOptions()
{
$table = new Table("foo");
$table->addOption("foo", "bar");
$this->assertTrue($table->hasOption("foo"));
$this->assertEquals("bar", $table->getOption("foo"));
}