| 1: | <?php |
| 2: | |
| 3: | declare(strict_types=1); |
| 4: | |
| 5: | namespace Atk4\Data\Model; |
| 6: | |
| 7: | trait FieldPropertiesTrait |
| 8: | { |
| 9: | /** Persistence field name, if null, shortName is used. */ |
| 10: | public ?string $actual = null; |
| 11: | /** Persistence option, if true, field is not loaded nor inserted/updated. */ |
| 12: | public bool $neverPersist = false; |
| 13: | /** Persistence option, if true, field is not inserted/updated. */ |
| 14: | public bool $neverSave = false; |
| 15: | |
| 16: | /** DBAL type registered in \Doctrine\DBAL\Types\Type. */ |
| 17: | public string $type; |
| 18: | /** Nullable field can be null, otherwise the value must be set, even if it is an empty value. */ |
| 19: | public bool $nullable = true; |
| 20: | /** Required field must have non-empty value. A null value is considered empty too. */ |
| 21: | public bool $required = false; |
| 22: | |
| 23: | /** @var array<int, mixed>|null For several types enum can provide list of available options. ['blue', 'red']. */ |
| 24: | public ?array $enum = null; |
| 25: | |
| 26: | /** |
| 27: | * For fields that can be selected, values can represent interpretation of the values, |
| 28: | * for instance ['F' => 'Female', 'M' => 'Male']. |
| 29: | * |
| 30: | * @var array<mixed, mixed>|null |
| 31: | */ |
| 32: | public ?array $values = null; |
| 33: | |
| 34: | /** |
| 35: | * If value of this field is defined by a model, this property will contain reference link. |
| 36: | */ |
| 37: | protected ?string $referenceLink = null; |
| 38: | |
| 39: | /** Is it system field? System fields are be always loaded and saved. */ |
| 40: | public bool $system = false; |
| 41: | |
| 42: | /** @var mixed Default value of field. */ |
| 43: | public $default; |
| 44: | |
| 45: | /** |
| 46: | * Is field read only? |
| 47: | * Field value may not be changed. It'll never be saved. |
| 48: | * For example, expressions are read only. |
| 49: | */ |
| 50: | public bool $readOnly = false; |
| 51: | |
| 52: | /** |
| 53: | * Defines a label to go along with this field. Use getCaption() which |
| 54: | * will always return meaningful label (even if caption is null). Set |
| 55: | * this property to any string. |
| 56: | * |
| 57: | * @var string|null |
| 58: | */ |
| 59: | public $caption; |
| 60: | |
| 61: | /** |
| 62: | * Array with UI flags like editable, visible and hidden. |
| 63: | * |
| 64: | * By default hasOne relation ID field should be editable in forms, |
| 65: | * but not visible in grids. UI should respect these flags. |
| 66: | * |
| 67: | * @var array<string, mixed> |
| 68: | */ |
| 69: | public array $ui = []; |
| 70: | } |
| 71: |