vendor/doctrine/orm/src/Mapping/Column.php line 17

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace Doctrine\ORM\Mapping;
  4. use Attribute;
  5. use BackedEnum;
  6. use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;
  7. /**
  8.  * @Annotation
  9.  * @NamedArgumentConstructor
  10.  * @Target({"PROPERTY","ANNOTATION"})
  11.  */
  12. #[Attribute(Attribute::TARGET_PROPERTY)]
  13. final class Column implements MappingAttribute
  14. {
  15.     /**
  16.      * @var string|null
  17.      * @readonly
  18.      */
  19.     public $name;
  20.     /**
  21.      * @var mixed
  22.      * @readonly
  23.      */
  24.     public $type;
  25.     /**
  26.      * @var int|null
  27.      * @readonly
  28.      */
  29.     public $length;
  30.     /**
  31.      * The precision for a decimal (exact numeric) column (Applies only for decimal column).
  32.      *
  33.      * @var int|null
  34.      * @readonly
  35.      */
  36.     public $precision = 0;
  37.     /**
  38.      * The scale for a decimal (exact numeric) column (Applies only for decimal column).
  39.      *
  40.      * @var int|null
  41.      * @readonly
  42.      */
  43.     public $scale = 0;
  44.     /**
  45.      * @var bool
  46.      * @readonly
  47.      */
  48.     public $unique = false;
  49.     /**
  50.      * @var bool
  51.      * @readonly
  52.      */
  53.     public $nullable = false;
  54.     /**
  55.      * @var bool
  56.      * @readonly
  57.      */
  58.     public $insertable = true;
  59.     /**
  60.      * @var bool
  61.      * @readonly
  62.      */
  63.     public $updatable = true;
  64.     /**
  65.      * @var class-string<BackedEnum>|null
  66.      * @readonly
  67.      */
  68.     public $enumType = null;
  69.     /**
  70.      * @var array<string,mixed>
  71.      * @readonly
  72.      */
  73.     public $options = [];
  74.     /**
  75.      * @var string|null
  76.      * @readonly
  77.      */
  78.     public $columnDefinition;
  79.     /**
  80.      * @var string|null
  81.      * @readonly
  82.      * @phpstan-var 'NEVER'|'INSERT'|'ALWAYS'|null
  83.      * @Enum({"NEVER", "INSERT", "ALWAYS"})
  84.      */
  85.     public $generated;
  86.     /**
  87.      * @param class-string<BackedEnum>|null $enumType
  88.      * @param array<string,mixed>           $options
  89.      * @phpstan-param 'NEVER'|'INSERT'|'ALWAYS'|null $generated
  90.      */
  91.     public function __construct(
  92.         ?string $name = null,
  93.         ?string $type = null,
  94.         ?int $length = null,
  95.         ?int $precision = null,
  96.         ?int $scale = null,
  97.         bool $unique = false,
  98.         bool $nullable = false,
  99.         bool $insertable = true,
  100.         bool $updatable = true,
  101.         ?string $enumType = null,
  102.         array $options = [],
  103.         ?string $columnDefinition = null,
  104.         ?string $generated = null
  105.     ) {
  106.         $this->name             = $name;
  107.         $this->type             = $type;
  108.         $this->length           = $length;
  109.         $this->precision        = $precision;
  110.         $this->scale            = $scale;
  111.         $this->unique           = $unique;
  112.         $this->nullable         = $nullable;
  113.         $this->insertable       = $insertable;
  114.         $this->updatable        = $updatable;
  115.         $this->enumType         = $enumType;
  116.         $this->options          = $options;
  117.         $this->columnDefinition = $columnDefinition;
  118.         $this->generated        = $generated;
  119.     }
  120. }