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


PHP Index::getColumns方法代码示例

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


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

示例1: indexToArray

 /**
  * @param string $table
  * @param \Doctrine\DBAL\Schema\Index $index
  * @return array
  */
 protected function indexToArray($table, $index)
 {
     if ($index->isPrimary()) {
         $type = 'primary';
     } elseif ($index->isUnique()) {
         $type = 'unique';
     } else {
         $type = 'index';
     }
     $array = ['type' => $type, 'name' => null, 'columns' => $index->getColumns()];
     if (!$this->isDefaultIndexName($table, $index->getName(), $type, $index->getColumns())) {
         $array['name'] = $index->getName();
     }
     return $array;
 }
开发者ID:19peaches,项目名称:laravel-generator,代码行数:20,代码来源:IndexParser.php

示例2: indexToArray

 /**
  * @param string $table
  * @param \Doctrine\DBAL\Schema\Index $index
  * @return array
  */
 protected function indexToArray($table, $index)
 {
     if ($index->isPrimary()) {
         $type = 'primary';
     } elseif ($index->isUnique()) {
         $type = 'unique';
     } else {
         $type = 'index';
     }
     $array = ['type' => $type, 'name' => null, 'columns' => $index->getColumns()];
     if (!$this->ignoreIndexNames and !$this->isDefaultIndexName($table, $index->getName(), $type, $index->getColumns())) {
         // Sent Index name to exclude spaces
         $array['name'] = str_replace(' ', '', $index->getName());
     }
     return $array;
 }
开发者ID:rohinigeeks,项目名称:laravel-sorcery,代码行数:21,代码来源:IndexGenerator.php

示例3: populatePrimaryKey

 /**
  * Populates a primary key based on a index.
  *
  * @param   Attrs  $attrs
  * @param   Index  $index
  */
 private function populatePrimaryKey($attrs, $index)
 {
     if (!$index->isPrimary()) {
         return;
     }
     $columns = $index->getColumns();
     $key = current($columns);
     // We don't support composite primary keys quite yet.
     if (count($columns) > 1) {
         return;
     }
     $attrs->set($this->deriveName($key), ['key' => $key, 'type' => 'primary']);
 }
开发者ID:drwrf,项目名称:mismatch-orm,代码行数:19,代码来源:Populator.php

示例4: getCreateSpatialIndexSQL

 /**
  * Generates the sql to create a spatial index.
  * 
  * @param SpatialIndex $index
  * @param Table | string $table
  * @return string The sql to create a spatial index on the database.
  * @throws \InvalidArgumentException
  */
 public function getCreateSpatialIndexSQL(Index $index, $table)
 {
     if ($table instanceof Table) {
         $table = $table->getQuotedName($this);
     }
     $name = $index->getQuotedName($this);
     $columns = $index->getColumns();
     if (count($columns) == 0) {
         throw new \InvalidArgumentException("Incomplete definition. 'columns' required.");
     }
     $query = 'CREATE INDEX ' . $name . ' ON ' . $table;
     $query .= ' USING GIST (' . $this->getIndexFieldDeclarationListSQL($columns) . ')';
     return $query;
 }
开发者ID:agnetsolutions,项目名称:dbal,代码行数:22,代码来源:PostGISPlatform.php

示例5: overrules

 /**
  * Detect if the other index is a non-unique, non primary index that can be overwritten by this one.
  *
  * @param Index $other
  * @return bool
  */
 public function overrules(Index $other)
 {
     if ($other->isPrimary()) {
         return false;
     } else {
         if ($this->isSimpleIndex() && $other->isUnique()) {
             return false;
         }
     }
     if ($this->spansColumns($other->getColumns()) && ($this->isPrimary() || $this->isUnique())) {
         return true;
     }
     return false;
 }
开发者ID:laiello,项目名称:masfletes,代码行数:20,代码来源:Index.php

示例6: getIndexDeclarationSQL

 /**
  * Obtain DBMS specific SQL code portion needed to set an index
  * declaration to be used in statements like CREATE TABLE.
  *
  * @param string $name          name of the index
  * @param Index $index          index definition
  * @return string               DBMS specific SQL code portion needed to set an index
  */
 public function getIndexDeclarationSQL($name, Index $index)
 {
     $type = '';
     if ($index->isUnique()) {
         $type = 'UNIQUE ';
     }
     if (count($index->getColumns()) == 0) {
         throw \InvalidArgumentException("Incomplete definition. 'columns' required.");
     }
     return $type . 'INDEX ' . $name . ' (' . $this->getIndexFieldDeclarationListSQL($index->getColumns()) . ')';
 }
开发者ID:pollux1er,项目名称:dlawebdev2,代码行数:19,代码来源:AbstractPlatform.php

示例7: _appendUniqueConstraintDefinition

 /**
  * Extend unique key constraint with required filters
  *
  * @param string $sql
  * @param Index $index
  * @return string
  */
 private function _appendUniqueConstraintDefinition($sql, Index $index)
 {
     $fields = array();
     foreach ($index->getColumns() as $field => $definition) {
         if (!is_array($definition)) {
             $field = $definition;
         }
         $fields[] = $field . ' IS NOT NULL';
     }
     return $sql . ' WHERE ' . implode(' AND ', $fields);
 }
开发者ID:OmondiKevin,项目名称:ADT_MTRH,代码行数:18,代码来源:MsSqlPlatform.php

示例8: getPreAlterTableAlterPrimaryKeySQL

 /**
  * @param TableDiff $diff
  * @param Index     $index
  *
  * @return string[]
  */
 private function getPreAlterTableAlterPrimaryKeySQL(TableDiff $diff, Index $index)
 {
     $sql = array();
     if (!$index->isPrimary() || !$diff->fromTable instanceof Table) {
         return $sql;
     }
     $tableName = $diff->getName($this)->getQuotedName($this);
     // Dropping primary keys requires to unset autoincrement attribute on the particular column first.
     foreach ($index->getColumns() as $columnName) {
         $column = $diff->fromTable->getColumn($columnName);
         if ($column->getAutoincrement() === true) {
             $column->setAutoincrement(false);
             $sql[] = 'ALTER TABLE ' . $tableName . ' MODIFY ' . $this->getColumnDeclarationSQL($column->getQuotedName($this), $column->toArray());
             // original autoincrement information might be needed later on by other parts of the table alteration
             $column->setAutoincrement(true);
         }
     }
     return $sql;
 }
开发者ID:doctrine,项目名称:dbal,代码行数:25,代码来源:MySqlPlatform.php

示例9: checkIndex

 /**
  * @param Table     $table
  * @param Index     $index
  * @param Migration $migration
  *
  * @throws InvalidNameException
  */
 protected function checkIndex(Table $table, Index $index, Migration $migration)
 {
     $columns = $index->getColumns();
     foreach ($columns as $columnName) {
         if ($table->getColumn($columnName)->getLength() > MySqlPlatform::LENGTH_LIMIT_TINYTEXT) {
             throw new InvalidNameException(sprintf('Could not create index for column with length more than %s. ' . 'Please correct "%s" column length "%s" in table in "%s" migration', MySqlPlatform::LENGTH_LIMIT_TINYTEXT, $columnName, $table->getName(), get_class($migration)));
         }
     }
 }
开发者ID:ramunasd,项目名称:platform,代码行数:16,代码来源:MigrationExecutor.php

示例10: intersectsIndexColumns

 /**
  * Checks whether this foreign key constraint intersects the given index columns.
  *
  * Returns `true` if at least one of this foreign key's local columns
  * matches one of the given index's columns, `false` otherwise.
  *
  * @param Index $index The index to be checked against.
  *
  * @return boolean
  */
 public function intersectsIndexColumns(Index $index)
 {
     foreach ($index->getColumns() as $indexColumn) {
         foreach ($this->_localColumnNames as $localColumn) {
             if (strtolower($indexColumn) === strtolower($localColumn->getName())) {
                 return true;
             }
         }
     }
     return false;
 }
开发者ID:Dren-x,项目名称:mobit,代码行数:21,代码来源:ForeignKeyConstraint.php

示例11: getIndexDeclarationSQL

 /**
  * Obtain DBMS specific SQL code portion needed to set an index
  * declaration to be used in statements like CREATE TABLE.
  *
  * @param string $name          name of the index
  * @param Index $index          index definition
  *
  * @return string               DBMS specific SQL code portion needed to set an index
  */
 public function getIndexDeclarationSQL($name, Index $index)
 {
     if (count($index->getColumns()) === 0) {
         throw new \InvalidArgumentException("Incomplete definition. 'columns' required.");
     }
     return $this->getCreateIndexSQLFlags($index) . 'INDEX ' . $name . ' (' . $this->getIndexFieldDeclarationListSQL($index->getColumns()) . ')';
 }
开发者ID:shinichi81,项目名称:laravel4demo,代码行数:16,代码来源:AbstractPlatform.php

示例12: saveIndex

 /**
  * @param Index $index
  * @param \SimpleXMLElement $xml
  */
 private static function saveIndex($index, $xml)
 {
     $xml->addChild('name', $index->getName());
     if ($index->isPrimary()) {
         $xml->addChild('primary', 'true');
     } elseif ($index->isUnique()) {
         $xml->addChild('unique', 'true');
     }
     foreach ($index->getColumns() as $column) {
         $field = $xml->addChild('field');
         $field->addChild('name', $column);
         $field->addChild('sorting', 'ascending');
     }
 }
开发者ID:GitHubUser4234,项目名称:core,代码行数:18,代码来源:MDB2SchemaWriter.php

示例13: createIndexReplacement

 /**
  * Creates a index replacement, which has quoted names.
  *
  * @param Index $index
  *
  * @return Index
  */
 private function createIndexReplacement(Index $index)
 {
     return new Index($this->platform->quoteIdentifier($index->getName()), $this->quoteIdentifiers($index->getColumns()), $index->isUnique(), $index->isPrimary(), $index->getFlags(), $index->getOptions());
 }
开发者ID:digilist,项目名称:snakedumper,代码行数:11,代码来源:IdentifierQuoter.php

示例14: acceptIndex

 /**
  * Accept an index on in a table
  *
  * @param Table $table a table object
  * @param Index $index a column object
  * 
  * @return void
  */
 public function acceptIndex(Table $table, Index $index)
 {
     $this->schemaArray['tables'][$table->getName()]['indexes'][$index->getName()] = array('name' => $index->getName(), 'columns' => $index->getColumns(), 'unique' => $index->isUnique(), 'primary' => $index->isPrimary());
 }
开发者ID:ming-hai,项目名称:XoopsCore,代码行数:12,代码来源:ExportVisitor.php


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