← All changes
|
backend/src/Repository/EntryField/EntryFieldRepositoryInterface.php
+41
-3
0.9
→
1.5
View file →
| @@ -6,8 +6,9 @@ | ||
| 6 | 6 | if (!defined('ABSPATH')) { |
| 7 | 7 | exit; // Exit if accessed directly |
| 8 | 8 | } |
| 9 | 9 | |
| 10 | +use IvyForms\Entity\EntryField\EntryField; | |
| 10 | 11 | use IvyForms\Repository\BaseRepositoryInterface; |
| 11 | 12 | |
| 12 | 13 | interface EntryFieldRepositoryInterface extends BaseRepositoryInterface |
| 13 | 14 | { |
| @@ -19,10 +20,10 @@ | ||
| 19 | 20 | */ |
| 20 | 21 | public function exists(int $entryFieldId): bool; |
| 21 | 22 | |
| 22 | 23 | /** |
| 23 | - * @param array<mixed> $array | |
| 24 | - * @return array<int, array<string, mixed>> | |
| 24 | + * @param array<string, string> $array | |
| 25 | + * @return array<int, EntryField> | |
| 25 | 26 | */ |
| 26 | 27 | public function findBy(array $array): array; |
| 27 | 28 | |
| 28 | 29 | /** |
| @@ -48,6 +49,43 @@ | ||
| 48 | 49 | * @param int $fieldId |
| 49 | 50 | * @param string $value |
| 50 | 51 | * @return bool |
| 51 | 52 | */ |
| 52 | - public function checkDuplicateValue(int $formId, int $fieldId, string $value): bool; | |
| 53 | + public function checkDuplicateValue( | |
| 54 | + int $formId, | |
| 55 | + int $fieldId, | |
| 56 | + string $value, | |
| 57 | + ?int $excludeEntryId = null | |
| 58 | + ): bool; | |
| 59 | + | |
| 60 | + /** | |
| 61 | + * Check if a normalized value matches any stored value after applying a normalizer. | |
| 62 | + * | |
| 63 | + * @param int $formId | |
| 64 | + * @param int $fieldId | |
| 65 | + * @param string $normalizedValue | |
| 66 | + * @param callable(string): string $normalizeStoredValue | |
| 67 | + * @return bool | |
| 68 | + */ | |
| 69 | + public function checkDuplicateValueNormalized( | |
| 70 | + int $formId, | |
| 71 | + int $fieldId, | |
| 72 | + string $normalizedValue, | |
| 73 | + callable $normalizeStoredValue, | |
| 74 | + ?int $excludeEntryId = null | |
| 75 | + ): bool; | |
| 76 | + | |
| 77 | + /** | |
| 78 | + * Batch-update fieldValue for existing entry_field rows of one entry. | |
| 79 | + * | |
| 80 | + * @param int $entryId | |
| 81 | + * @param list<array{id: int, fieldValue: string}> $updates | |
| 82 | + */ | |
| 83 | + public function batchUpdateValues(int $entryId, array $updates): void; | |
| 84 | + | |
| 85 | + /** | |
| 86 | + * Multi-row insert of entry_field rows. Sets generated IDs on the entities. | |
| 87 | + * | |
| 88 | + * @param list<EntryField> $entryFields | |
| 89 | + */ | |
| 90 | + public function batchInsert(array $entryFields): void; | |
| 53 | 91 | } |