KeyColumn.php

Same filename and directory in other branches
  1. 11.x core/lib/Drupal/Core/Database/SchemaDefinition/KeyColumn.php

Namespace

Drupal\Core\Database\SchemaDefinition

File

core/lib/Drupal/Core/Database/SchemaDefinition/KeyColumn.php

View source
<?php

declare (strict_types=1);
namespace Drupal\Core\Database\SchemaDefinition;


/**
 * Describes a column of a database index or key.
 */
final class KeyColumn implements SchemaDefinitionInterface {
  
  /**
   * Constructor.
   *
   * @param string $name
   *   The column name.
   * @param int|null $length
   *   (Optional) if set, specifies a prefix of the named column.
   */
  public function __construct(public readonly string $name, public readonly ?int $length = NULL) {
  }
  
  /**
   * The key column cannot be converted to an array.
   *
   * @throws \LogicException
   */
  public function toArray() : array {
    throw new \LogicException(__METHOD__ . ' is not implemented');
  }

}

Classes

Title Deprecated Summary
KeyColumn Describes a column of a database index or key.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.