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


PHP Context::getStructure方法代码示例

本文整理汇总了PHP中Nette\Database\Context::getStructure方法的典型用法代码示例。如果您正苦于以下问题:PHP Context::getStructure方法的具体用法?PHP Context::getStructure怎么用?PHP Context::getStructure使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Nette\Database\Context的用法示例。


在下文中一共展示了Context::getStructure方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getPrimarySequence

 /**
  * @return string
  */
 public function getPrimarySequence()
 {
     if ($this->primarySequence === FALSE) {
         $this->primarySequence = $this->context->getStructure()->getPrimaryKeySequence($this->name);
     }
     return $this->primarySequence;
 }
开发者ID:jave007,项目名称:test,代码行数:10,代码来源:Selection.php

示例2: __construct

 public function __construct($tableName, Context $context)
 {
     $this->tableName = $tableName;
     $this->driver = $context->getConnection()->getSupplementalDriver();
     $this->conventions = $context->getConventions();
     $this->structure = $context->getStructure();
     $this->delimitedTable = implode('.', array_map([$this->driver, 'delimite'], explode('.', $tableName)));
 }
开发者ID:ricco24,项目名称:database,代码行数:8,代码来源:SqlBuilder.php

示例3: initializeDataStructure

 protected function initializeDataStructure($tableName, $primaryKey)
 {
     $dataStructure = new Structures\DataStructure($tableName, $primaryKey);
     $this->setDataStructure($dataStructure);
     $structure = $this->context->getStructure();
     $columns = $structure->getColumns($this->getTableName());
     Helpers::setStructureFromColumns($dataStructure, $this->determineFromColumns($columns));
     foreach ($structure->getBelongsToReference($tableName) as $key => $table) {
         $dataStructure->getOrCreateTableStructure($table, $structure->getPrimaryKey($table));
         $targetReference = $structure->getBelongsToReference($table);
         $hasOneToOne = array_search($tableName, $targetReference);
         if ($hasOneToOne) {
             $field = $dataStructure->addOneToOne($table, $table, $key);
         } else {
             $field = $dataStructure->addManyToOne($table, $table, $key);
         }
         $column = $this->findColumn($columns, $key);
         $field->setNullable($column['nullable']);
     }
     foreach ($structure->getHasManyReference($tableName) as $table => $keys) {
         $dataStructure->getOrCreateTableStructure($table, $structure->getPrimaryKey($table));
         $sourceReference = $structure->getBelongsToReference($tableName);
         if (in_array($table, $sourceReference)) {
             continue;
         }
         $targetReference = $structure->getBelongsToReference($table);
         if (count($targetReference) > 1) {
             $match = null;
             foreach ($keys as $key => $targetTable) {
                 $match = array_search($tableName, $targetReference);
                 if ($match) {
                     unset($targetReference[$match]);
                     break;
                 }
             }
             if ($match) {
                 $arrayKeys = array_keys($targetReference);
                 $selfColumn = reset($arrayKeys);
                 $currentValue = reset($targetReference);
                 $dataStructure->getOrCreateTableStructure($currentValue, $structure->getPrimaryKey($currentValue));
                 $dataStructure->addManyToMany($currentValue, $currentValue, $selfColumn, $table, $match);
                 continue;
             }
         }
         $match = null;
         foreach ($keys as $key => $targetTable) {
             $match = array_search($tableName, $targetReference);
             if ($match) {
                 unset($targetReference[$match]);
                 break;
             }
         }
         if ($match) {
             $dataStructure->addOneToMany($table, $table, $match);
         }
     }
 }
开发者ID:mesour,项目名称:sources,代码行数:57,代码来源:NetteDbTableSource.php

示例4: __construct

 public function __construct(Context $databaseContext)
 {
     $this->databaseContext = $databaseContext;
     $this->databaseStructure = $databaseContext->getStructure();
     $this->databaseConventions = $databaseContext->getConventions();
 }
开发者ID:Zarganwar,项目名称:orm,代码行数:6,代码来源:NetteMapper.php


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