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


PHP Column::getNotNull方法代码示例

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


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

示例1: 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

示例2: prepareColumnData

 /**
  * @param \Doctrine\DBAL\Schema\Column $column The name of the table.
  * @param array $primaries
  *
  * @return array The column data as associative array.
  */
 public function prepareColumnData($column, $primaries = array())
 {
     $columnData = array();
     $columnData['name'] = $column->getQuotedName($this);
     $columnData['type'] = $column->getType();
     $columnData['length'] = $column->getLength();
     $columnData['notnull'] = $column->getNotNull();
     $columnData['fixed'] = $column->getFixed();
     $columnData['unique'] = false;
     // TODO: what do we do about this?
     $columnData['version'] = $column->hasPlatformOption("version") ? $column->getPlatformOption('version') : false;
     if (strtolower($columnData['type']) == "string" && $columnData['length'] === null) {
         $columnData['length'] = 255;
     }
     $columnData['unsigned'] = $column->getUnsigned();
     $columnData['precision'] = $column->getPrecision();
     $columnData['scale'] = $column->getScale();
     $columnData['default'] = $column->getDefault();
     $columnData['columnDefinition'] = $column->getColumnDefinition();
     $columnData['autoincrement'] = $column->getAutoincrement();
     $columnData['comment'] = $this->getColumnComment($column);
     $columnData['platformOptions'] = $column->getPlatformOptions();
     if (in_array($column->getName(), $primaries)) {
         $columnData['primary'] = true;
     }
     return $columnData;
 }
开发者ID:crate,项目名称:crate-dbal,代码行数:33,代码来源:CratePlatform.php


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