| @@ -1,0 +1,88 @@ | ||
| 1 | +<?php | |
| 2 | + | |
| 3 | +namespace IvyForms\Entity\EntryField; | |
| 4 | + | |
| 5 | +use IvyForms\ValueObjects\Entry\EntryField as EntryFieldValueObject; | |
| 6 | + | |
| 7 | +/** | |
| 8 | + * Class EntryField | |
| 9 | + * | |
| 10 | + * @package IvyForms\Entity\Entry | |
| 11 | + */ | |
| 12 | +class EntryField | |
| 13 | +{ | |
| 14 | + /** | |
| 15 | + * @var EntryFieldValueObject | |
| 16 | + */ | |
| 17 | + private EntryFieldValueObject $field; | |
| 18 | + | |
| 19 | + /** | |
| 20 | + * EntryField constructor. | |
| 21 | + * | |
| 22 | + * @param EntryFieldValueObject $field The entry field value object. | |
| 23 | + */ | |
| 24 | + public function __construct(EntryFieldValueObject $field) | |
| 25 | + { | |
| 26 | + $this->field = $field; | |
| 27 | + } | |
| 28 | + | |
| 29 | + public function getId(): ?int | |
| 30 | + { | |
| 31 | + return $this->field->id; | |
| 32 | + } | |
| 33 | + public function setId(int $id): void | |
| 34 | + { | |
| 35 | + $this->field->id = $id; | |
| 36 | + } | |
| 37 | + | |
| 38 | + public function getFieldId(): int | |
| 39 | + { | |
| 40 | + return $this->field->fieldId; | |
| 41 | + } | |
| 42 | + public function setFieldId(int $fieldId): void | |
| 43 | + { | |
| 44 | + $this->field->fieldId = $fieldId; | |
| 45 | + } | |
| 46 | + | |
| 47 | + public function getFieldValue(): string | |
| 48 | + { | |
| 49 | + return $this->field->fieldValue; | |
| 50 | + } | |
| 51 | + public function setFieldValue(string $fieldValue): void | |
| 52 | + { | |
| 53 | + $this->field->fieldValue = $fieldValue; | |
| 54 | + } | |
| 55 | + public function getField(): EntryFieldValueObject | |
| 56 | + { | |
| 57 | + return $this->field; | |
| 58 | + } | |
| 59 | + /** | |
| 60 | + * Get the entry ID associated with the entry field. | |
| 61 | + * | |
| 62 | + * @return int|null The entry ID or null if not set. | |
| 63 | + */ | |
| 64 | + | |
| 65 | + public function getEntryId(): ?int | |
| 66 | + { | |
| 67 | + return $this->field->entryId; | |
| 68 | + } | |
| 69 | + /** | |
| 70 | + * Set the entry ID associated with the entry field. | |
| 71 | + * | |
| 72 | + * @param int|null $entryId The entry ID to set. | |
| 73 | + */ | |
| 74 | + public function setEntryId(?int $entryId): void | |
| 75 | + { | |
| 76 | + $this->field->entryId = $entryId; | |
| 77 | + } | |
| 78 | + | |
| 79 | + /** | |
| 80 | + * Convert the entry field to an array representation. | |
| 81 | + * | |
| 82 | + * @return array<mixed> The array representation of the entry field. | |
| 83 | + */ | |
| 84 | + public function toArray(): array | |
| 85 | + { | |
| 86 | + return $this->field->toArray(); | |
| 87 | + } | |
| 88 | +} | |