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


PHP Column::getName方法代码示例

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


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

示例1: __construct

 public function __construct(TableInformation $parent, \Doctrine\DBAL\Schema\Table $table, \Doctrine\DBAL\Schema\Column $column)
 {
     $this->table = $parent;
     foreach ($table->getForeignKeys() as $foreign) {
         if (in_array($column->getName(), $foreign->getColumns())) {
             $foreign_columns = $foreign->getForeignColumns();
             $this->foreignTable = $foreign->getForeignTableName();
             $this->foreignColumn = reset($foreign_columns);
             $this->isForeign = true;
         }
     }
     if ($primary_key = $table->getPrimaryKey()) {
         $this->isPrimary = in_array($column->getName(), $primary_key->getColumns());
     }
     $this->name = $column->getName();
     $this->type = $column->getType()->getName();
     $this->length = $column->getLength();
     $this->precision = $column->getPrecision();
     $this->default = $column->getDefault();
     $this->isNotNull = $column->getNotnull();
     $this->isUnsigned = $column->getUnsigned();
     $this->isFixed = $column->getFixed();
     $this->isAutoIncrement = $column->getAutoincrement();
     $this->comment = $column->getComment();
     if ($this->type === \Doctrine\DBAL\Types\Type::BLOB) {
         $this->length = min($this->bytesFromIni('post_max_size'), $this->bytesFromIni('upload_max_filesize'));
     }
 }
开发者ID:alanedwardes,项目名称:carbo,代码行数:28,代码来源:ColumnInformation.php

示例2: createInput

 /**
  * Method for create a input for new form
  *
  * @param \Doctrine\DBAL\Schema\Column $objColumn
  * @param array $arrForeignKeys Foreign keys
  * @return string
  */
 public function createInput(Column $objColumn, $arrForeignKeys)
 {
     if ($objColumn->getType() instanceof FloatType) {
         $objInputFilter = new GeneratorFilterInputTypeFloat($objColumn, $arrForeignKeys);
         return $objInputFilter->getStrCreateInputFilter();
     }
     return '$filter' . $this->underscoreToCamelcase($objColumn->getName()) . ' = new BaseInputFilter(' . '"' . $this->underscoreToLowerCamelcase($objColumn->getName()) . '", ' . $this->getParamsToHaystack($arrForeignKeys[$objColumn->getName()]) . ', ' . (bool) $objColumn->getNotnull() . ', true' . $this->getStrMinAndMaxlength($objColumn, $arrForeignKeys) . ');' . PHP_EOL . '$this->add($filter' . $this->underscoreToCamelcase($objColumn->getName()) . ');' . PHP_EOL . PHP_EOL;
 }
开发者ID:diego-mi,项目名称:financeiro,代码行数:15,代码来源:GeneratorInputFilterHelper.php

示例3: generateField

 /**
  * @param \Doctrine\DBAL\Schema\Column $column
  * @param mixed $value
  */
 public function generateField($column, $value = null)
 {
     if ($value) {
         $this->value = $value;
     }
     $this->setLabel($column->getName());
     $this->name = $column->getName();
     return $this;
 }
开发者ID:albafo,项目名称:web.MagickLaravel,代码行数:13,代码来源:WysiwygField.php

示例4: createColumnReplacement

 /**
  * Creates a column replacement, which has a quoted name.
  *
  * @param Column $column
  *
  * @return Column
  */
 private function createColumnReplacement(Column $column)
 {
     $columnConfig = $column->toArray();
     $columnConfig['platformOptions'] = $column->getPlatformOptions();
     $columnConfig['customSchemaOptions'] = $column->getCustomSchemaOptions();
     return new Column($this->platform->quoteIdentifier($column->getName()), $column->getType(), $columnConfig);
 }
开发者ID:digilist,项目名称:snakedumper,代码行数:14,代码来源:IdentifierQuoter.php

示例5: execute

 /**
  * Check for Sequence Duplicates.
  * 
  * Episodes of the same entity that overlap in time.
  * 
  * @access public
  * @return boolean the result of the operation
  * @param mixed     $oMixed     The Entity to do operation on
  */
 public function execute($oMixed)
 {
     $oOperation = $this->oOperation;
     $oConnection = $this->oConnection;
     # execute operation, only care if its successful
     $bResult = $oOperation->execute($oMixed);
     $sTableName = $this->sTableName;
     if (true === $bResult) {
         try {
             $oInnerQuery = new QueryBuilder($oConnection);
             $oInnerQuery->select('count(*)')->from($sTableName, 's2')->andWhere('s1.' . $this->oFromColum->getName() . ' < s2.' . $this->oToColumn->getName() . ' ')->andWhere('s2.' . $this->oFromColum->getName() . ' < s1.' . $this->oToColumn->getName() . ' ');
             # process the key columns
             foreach ($this->oNaturalKeyColumns as $oColumn) {
                 $oInnerQuery->andWhere('s1.' . $oColumn->getName() . ' = s2.' . $oColumn->getName() . ' ');
             }
             // verify the consistence
             $sSql = "SELECT count(*) FROM '.{$sTableName}.' AS s1\n                    WHERE 1 < (\n                        '.{$oInnerQuery->getSql}().'        \n                ); ";
             $iCount = (int) $oConnection->fetchColumn($sSql, array(), 0);
             if ($iCount > 0) {
                 throw new VoucherException('This entity has a sequence duplicate unable to finish operation');
             }
         } catch (DBALException $e) {
             throw new VoucherException($e->getMessage(), 0, $e);
         }
     }
     return $bResult;
 }
开发者ID:rayhan0421,项目名称:GeneralLedger,代码行数:36,代码来源:TemporalValidDecorator.php

示例6: getSql

 public function getSql(Column $column, $table)
 {
     if (!$table instanceof Table) {
         $table = new Identifier($table);
     }
     $sql = array();
     $normalized = $column->getType()->getNormalizedPostGISColumnOptions($column->getCustomSchemaOptions());
     $srid = $normalized['srid'];
     // PostGIS 1.5 uses -1 for undefined SRID's
     if ($srid <= 0) {
         $srid = -1;
     }
     $type = strtoupper($normalized['geometry_type']);
     if ('ZM' === substr($type, -2)) {
         $dimension = 4;
         $type = substr($type, 0, -2);
     } elseif ('M' === substr($type, -1)) {
         $dimension = 3;
     } elseif ('Z' === substr($type, -1)) {
         $dimension = 3;
         $type = substr($type, 0, -1);
     } else {
         $dimension = 2;
     }
     // Geometry columns are created by the AddGeometryColumn stored procedure
     $sql[] = sprintf("SELECT AddGeometryColumn('%s', '%s', %d, '%s', %d)", $table->getName(), $column->getName(), $srid, $type, $dimension);
     if ($column->getNotnull()) {
         // Add a NOT NULL constraint to the field
         $sql[] = sprintf('ALTER TABLE %s ALTER %s SET NOT NULL', $table->getQuotedName($this->platform), $column->getQuotedName($this->platform));
     }
     return $sql;
 }
开发者ID:novikovsergey,项目名称:doctrine-postgis,代码行数:32,代码来源:SpatialColumnSqlGenerator.php

示例7: checkColumn

 /**
  * Do checks for columns.
  *
  * @param Column $column
  * @param array  $alterData
  *
  * @return boolean
  */
 protected function checkColumn(Column $column, array $alterData)
 {
     // Not needed to be implemented yet
     if ($alterData['propertyName'] !== $column->getName()) {
         return false;
     }
     return false;
 }
开发者ID:somekoala,项目名称:bolt,代码行数:16,代码来源:DiffUpdater.php

示例8: checkColumn

 /**
  * Do checks for columns.
  *
  * @param Column        $column
  * @param IgnoredChange $ignoredChange
  *
  * @return boolean
  */
 protected function checkColumn(Column $column, IgnoredChange $ignoredChange)
 {
     // Not needed to be implemented yet
     if ($ignoredChange->getPropertyName() !== $column->getName()) {
         return false;
     }
     return false;
 }
开发者ID:zomars,项目名称:bolt,代码行数:16,代码来源:DiffUpdater.php

示例9: testQuotedColumnName

 /**
  * @group DBAL-64
  */
 public function testQuotedColumnName()
 {
     $string = Type::getType('string');
     $column = new Column("`bar`", $string, array());
     $mysqlPlatform = new \Doctrine\DBAL\Platforms\MySqlPlatform();
     $sqlitePlatform = new \Doctrine\DBAL\Platforms\SqlitePlatform();
     $this->assertEquals('bar', $column->getName());
     $this->assertEquals('`bar`', $column->getQuotedName($mysqlPlatform));
     $this->assertEquals('"bar"', $column->getQuotedName($sqlitePlatform));
 }
开发者ID:dracony,项目名称:forked-php-orm-benchmark,代码行数:13,代码来源:ColumnTest.php

示例10: buildColumn

 /**
  * @param Column $column
  * @param Collection $foreignKeyColumns
  * @param Collection $foreignTables
  * @param Collection $indexes
  * @return ColumnInterface
  */
 protected function buildColumn(Column $column, Collection $foreignKeyColumns, Collection $foreignTables, Collection $indexes)
 {
     $uniqued = $indexes->filter(function (Index $index) use($column) {
         return $index->getColumns()[0] == $column->getName() && $index->isUnique();
     })->count() > 0;
     if ($column->getAutoincrement()) {
         return new ColumnAutoincrement($column, null, null, $uniqued);
     } else {
         if ($foreignKeyColumns->has($column->getName())) {
             $table = $foreignKeyColumns->get($column->getName());
             return new ColumnSelect($column, $table, $foreignTables->get($table), $uniqued);
         } else {
             if ($column->getType()->getName() == Type::INTEGER) {
                 return new ColumnNumericText($column, null, null, $uniqued);
             } else {
                 return new ColumnText($column, null, null, $uniqued);
             }
         }
     }
 }
开发者ID:shin1x1,项目名称:laravel-table-admin,代码行数:27,代码来源:ColumnCollectionFactory.php

示例11: getHtmlAttributes

 /**
  * @param \Doctrine\DBAL\Schema\Column $column
  * @param mixed $value
  * @return string
  */
 protected function getHtmlAttributes($column, $value = null)
 {
     $result = "";
     if (isset($value)) {
         $result .= "value='{$value}' ";
     }
     if ($name = $column->getName()) {
         $fieldName = $this->generateFieldName($name);
         $result .= "id='field_{$name}'  {$fieldName}";
     }
     return $result;
 }
开发者ID:albafo,项目名称:web.MagickLaravel,代码行数:17,代码来源:InputField.php

示例12: generateField

 /**
  * @param \Doctrine\DBAL\Schema\Column $column
  * @param mixed $value
  */
 public function generateField($column, $value = null)
 {
     $multiple = false;
     $options = $column->getValues();
     $options_temp = array();
     foreach ($options as $index => $option) {
         $option = str_replace("'", '', $option);
         $option = str_replace("\"", '', $option);
         $options_temp[$option] = $option;
     }
     $options = $options_temp;
     if (!$column->hasUniqueValue()) {
         $multiple = true;
     }
     $value = explode(",", $value);
     $name = $column->getName();
     return $this->generateFilledField($options, $name, $multiple, $value);
 }
开发者ID:albafo,项目名称:web.MagickLaravel,代码行数:22,代码来源:SelectField.php

示例13: guessFormItemType

 /**
  * @param Column $column
  * @return string
  */
 protected function guessFormItemType(Column $column)
 {
     $name = $column->getName();
     $foreignKey = $this->getForeignKey($name);
     if (!is_null($foreignKey)) {
         return 'select';
     }
     $type = $column->getType()->getName();
     if ($type == 'string' && $this->isEnumColumn($name)) {
         return 'select';
     }
     $lookup = ['string' => 'text', 'text' => 'ckeditor', 'integer' => 'text', 'float' => 'text', 'boolean' => 'checkbox', 'date' => 'date', 'time' => 'time', 'datetime' => 'timestamp'];
     return Arr::get($lookup, $type, 'text');
 }
开发者ID:DimaPikash,项目名称:eshop,代码行数:18,代码来源:ModelCompiler.php

示例14: buildFieldMapping

 /**
  * Build field mapping from a schema column definition
  *
  * @param string                       $tableName
  * @param \Doctrine\DBAL\Schema\Column $column
  *
  * @return array
  */
 private function buildFieldMapping($tableName, Column $column)
 {
     $fieldMapping = array('fieldName' => $this->getFieldNameForColumn($tableName, $column->getName(), false), 'columnName' => $column->getName(), 'type' => $column->getType()->getName(), 'nullable' => !$column->getNotNull());
     // Type specific elements
     switch ($fieldMapping['type']) {
         case Type::TARRAY:
         case Type::BLOB:
         case Type::GUID:
         case Type::JSON_ARRAY:
         case Type::OBJECT:
         case Type::SIMPLE_ARRAY:
         case Type::STRING:
         case Type::TEXT:
             $fieldMapping['length'] = $column->getLength();
             $fieldMapping['options']['fixed'] = $column->getFixed();
             break;
         case Type::DECIMAL:
         case Type::FLOAT:
             $fieldMapping['precision'] = $column->getPrecision();
             $fieldMapping['scale'] = $column->getScale();
             break;
         case Type::INTEGER:
         case Type::BIGINT:
         case Type::SMALLINT:
             $fieldMapping['options']['unsigned'] = $column->getUnsigned();
             break;
     }
     // Comment
     if (($comment = $column->getComment()) !== null) {
         $fieldMapping['options']['comment'] = $comment;
     }
     // Weather
     if (($default = $column->getDefault()) !== null) {
         $fieldMapping['options']['default'] = $default;
     }
     return $fieldMapping;
 }
开发者ID:rolas123,项目名称:weather-homework,代码行数:45,代码来源:DatabaseDriver.php

示例15: acceptColumn

 public function acceptColumn(Table $table, Column $column)
 {
     $this->addViolation('Table ' . $table->getName() . ' column ' . $column->getName(), $this->isReservedWord($column->getName()));
 }
开发者ID:manish436,项目名称:zform,代码行数:4,代码来源:ReservedKeywordsValidator.php


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