| Total Complexity | 4 |
| Total Lines | 57 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 17 | trait IndexedUniqueIntegerFieldTrait |
||
| 18 | { |
||
| 19 | /** |
||
| 20 | * @var int |
||
| 21 | */ |
||
| 22 | private $indexedUniqueInteger; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * @SuppressWarnings(PHPMD.StaticAccess) |
||
| 26 | * @param ClassMetadataBuilder $builder |
||
| 27 | */ |
||
| 28 | 3 | public static function metaForIndexedUniqueInteger(ClassMetadataBuilder $builder): void |
|
| 29 | { |
||
| 30 | 3 | $fieldBuilder = new FieldBuilder( |
|
| 31 | 3 | $builder, |
|
| 32 | [ |
||
| 33 | 3 | 'fieldName' => IndexedUniqueIntegerFieldInterface::PROP_INDEXED_UNIQUE_INTEGER, |
|
| 34 | 'type' => Type::INTEGER, |
||
| 35 | ] |
||
| 36 | ); |
||
| 37 | $fieldBuilder |
||
| 38 | 3 | ->columnName( |
|
| 39 | 3 | MappingHelper::getColumnNameForField( |
|
| 40 | 3 | IndexedUniqueIntegerFieldInterface::PROP_INDEXED_UNIQUE_INTEGER |
|
| 41 | ) |
||
| 42 | ) |
||
| 43 | 3 | ->nullable(false) |
|
| 44 | 3 | ->unique() |
|
| 45 | 3 | ->build(); |
|
| 46 | 3 | } |
|
| 47 | |||
| 48 | /** |
||
| 49 | * @return int |
||
| 50 | */ |
||
| 51 | 3 | public function getIndexedUniqueInteger(): int |
|
| 54 | } |
||
| 55 | |||
| 56 | /** |
||
| 57 | * @param int $indexedUniqueInteger |
||
| 58 | * |
||
| 59 | * @return self |
||
| 60 | */ |
||
| 61 | 3 | private function setIndexedUniqueInteger(int $indexedUniqueInteger): self |
|
| 62 | { |
||
| 63 | 3 | $this->updatePropertyValue( |
|
|
|
|||
| 64 | 3 | IndexedUniqueIntegerFieldInterface::PROP_INDEXED_UNIQUE_INTEGER, |
|
| 65 | 3 | $indexedUniqueInteger |
|
| 66 | ); |
||
| 67 | |||
| 68 | 3 | return $this; |
|
| 69 | } |
||
| 70 | |||
| 71 | 3 | private function initIndexedUniqueInteger(): void |
|
| 74 | 3 | } |
|
| 75 | } |
||
| 76 |