当前位置: 首页>>代码示例>>PHP>>正文


PHP Table::getOption方法代码示例

本文整理汇总了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];
         }
     }
 }
开发者ID:Raistlfiren,项目名称:bolt,代码行数:40,代码来源:MetadataDriver.php

示例2: testBuilderOptions

 public function testBuilderOptions()
 {
     $table = new Table("foo");
     $table->addOption("foo", "bar");
     $this->assertTrue($table->hasOption("foo"));
     $this->assertEquals("bar", $table->getOption("foo"));
 }
开发者ID:dracony,项目名称:forked-php-orm-benchmark,代码行数:7,代码来源:TableTest.php


注:本文中的Doctrine\DBAL\Schema\Table::getOption方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。