You are here

public function Enum::__construct in Drupal driver for SQL Server and SQL Azure 8

Creates a new value of some type

Parameters

mixed $value:

Throws

\UnexpectedValueException if incompatible type is given.

File

drivers/lib/Drupal/Driver/Database/sqlsrv/Enum.php, line 31

Class

Enum
Base Enum class

Namespace

Drupal\Driver\Database\sqlsrv

Code

public function __construct($value) {
  if (!$this
    ->isValid($value)) {
    throw new \UnexpectedValueException("Value '{$value}' is not part of the enum " . get_called_class());
  }
  $this->value = $value;
}