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


PHP Column::getPlatformOptions方法代码示例

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


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

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

示例2: diffColumn

 /**
  * Returns the difference between the fields $field1 and $field2.
  *
  * If there are differences this method returns $field2, otherwise the
  * boolean false.
  *
  * @param \Doctrine\DBAL\Schema\Column $column1
  * @param \Doctrine\DBAL\Schema\Column $column2
  *
  * @return array
  */
 public function diffColumn(Column $column1, Column $column2)
 {
     $properties1 = $column1->toArray();
     $properties2 = $column2->toArray();
     $changedProperties = array();
     foreach (array('type', 'notnull', 'unsigned', 'autoincrement') as $property) {
         if ($properties1[$property] != $properties2[$property]) {
             $changedProperties[] = $property;
         }
     }
     if ($properties1['default'] != $properties2['default'] || null === $properties1['default'] && null !== $properties2['default'] || null === $properties2['default'] && null !== $properties1['default']) {
         $changedProperties[] = 'default';
     }
     if ($properties1['type'] instanceof Types\StringType && !$properties1['type'] instanceof Types\GuidType || $properties1['type'] instanceof Types\BinaryType) {
         // check if value of length is set at all, default value assumed otherwise.
         $length1 = $properties1['length'] ?: 255;
         $length2 = $properties2['length'] ?: 255;
         if ($length1 != $length2) {
             $changedProperties[] = 'length';
         }
         if ($properties1['fixed'] != $properties2['fixed']) {
             $changedProperties[] = 'fixed';
         }
     } elseif ($properties1['type'] instanceof Types\DecimalType) {
         if (($properties1['precision'] ?: 10) != ($properties2['precision'] ?: 10)) {
             $changedProperties[] = 'precision';
         }
         if ($properties1['scale'] != $properties2['scale']) {
             $changedProperties[] = 'scale';
         }
     }
     // A null value and an empty string are actually equal for a comment so they should not trigger a change.
     if ($properties1['comment'] !== $properties2['comment'] && !(null === $properties1['comment'] && '' === $properties2['comment']) && !(null === $properties2['comment'] && '' === $properties1['comment'])) {
         $changedProperties[] = 'comment';
     }
     $customOptions1 = $column1->getCustomSchemaOptions();
     $customOptions2 = $column2->getCustomSchemaOptions();
     // Remove option-as-object
     foreach ($customOptions2 as $k => $v) {
         if (is_object($v)) {
             unset($customOptions2[$k]);
         }
     }
     foreach (array_merge(array_keys($customOptions1), array_keys($customOptions2)) as $key) {
         if (!array_key_exists($key, $properties1) || !array_key_exists($key, $properties2)) {
             $changedProperties[] = $key;
         } elseif ($properties1[$key] !== $properties2[$key]) {
             $changedProperties[] = $key;
         }
     }
     $platformOptions1 = $column1->getPlatformOptions();
     $platformOptions2 = $column2->getPlatformOptions();
     foreach (array_keys(array_intersect_key($platformOptions1, $platformOptions2)) as $key) {
         if ($properties1[$key] !== $properties2[$key]) {
             $changedProperties[] = $key;
         }
     }
     return array_unique($changedProperties);
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:70,代码来源:Comparator.php

示例3: diffColumn

 /**
  * Returns the difference between the fields $field1 and $field2.
  *
  * If there are differences this method returns $field2, otherwise the
  * boolean false.
  *
  * @param \Doctrine\DBAL\Schema\Column $column1
  * @param \Doctrine\DBAL\Schema\Column $column2
  *
  * @return array
  */
 public function diffColumn(Column $column1, Column $column2)
 {
     $properties1 = $column1->toArray();
     $properties2 = $column2->toArray();
     $changedProperties = array();
     foreach (array('type', 'notnull', 'unsigned', 'autoincrement') as $property) {
         if ($properties1[$property] != $properties2[$property]) {
             $changedProperties[] = $property;
         }
     }
     if ($properties1['default'] != $properties2['default'] || null === $properties1['default'] && null !== $properties2['default'] || null === $properties2['default'] && null !== $properties1['default']) {
         $changedProperties[] = 'default';
     }
     if ($properties1['type'] instanceof Types\StringType || $properties1['type'] instanceof Types\BinaryType) {
         // check if value of length is set at all, default value assumed otherwise.
         $length1 = $properties1['length'] ?: 255;
         $length2 = $properties2['length'] ?: 255;
         if ($length1 != $length2) {
             $changedProperties[] = 'length';
         }
         if ($properties1['fixed'] != $properties2['fixed']) {
             $changedProperties[] = 'fixed';
         }
     } elseif ($properties1['type'] instanceof Types\DecimalType) {
         if (($properties1['precision'] ?: 10) != ($properties2['precision'] ?: 10)) {
             $changedProperties[] = 'precision';
         }
         if ($properties1['scale'] != $properties2['scale']) {
             $changedProperties[] = 'scale';
         }
     }
     // only allow to delete comment if its set to '' not to null.
     if ($properties1['comment'] !== null && $properties1['comment'] != $properties2['comment']) {
         $changedProperties[] = 'comment';
     }
     $customOptions1 = $column1->getCustomSchemaOptions();
     $customOptions2 = $column2->getCustomSchemaOptions();
     foreach (array_merge(array_keys($customOptions1), array_keys($customOptions2)) as $key) {
         if (!array_key_exists($key, $properties1) || !array_key_exists($key, $properties2)) {
             $changedProperties[] = $key;
         } elseif ($properties1[$key] !== $properties2[$key]) {
             $changedProperties[] = $key;
         }
     }
     $platformOptions1 = $column1->getPlatformOptions();
     $platformOptions2 = $column2->getPlatformOptions();
     foreach (array_keys(array_intersect_key($platformOptions1, $platformOptions2)) as $key) {
         if ($properties1[$key] !== $properties2[$key]) {
             $changedProperties[] = $key;
         }
     }
     return array_unique($changedProperties);
 }
开发者ID:hilmysyarif,项目名称:l4-bootstrap-admin,代码行数:64,代码来源:Comparator.php


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