← All changes
|
backend/src/Repository/EntryField/EntryFieldRepositoryInterface.php
+58
-2
0.3
→
1.5.1
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 | /** |
| @@ -31,5 +32,60 @@ | ||
| 31 | 32 | * @param int[] $entryIds |
| 32 | 33 | * @return int[] |
| 33 | 34 | */ |
| 34 | 35 | public function findIdsByEntryIds(array $entryIds): array; |
| 36 | + | |
| 37 | + /** | |
| 38 | + * Delete multiple entry fields by their IDs in a single query. | |
| 39 | + * | |
| 40 | + * @param int[] $formIds | |
| 41 | + * @return int Number of deleted rows | |
| 42 | + */ | |
| 43 | + public function deleteByFormIds(array $formIds): int; | |
| 44 | + | |
| 45 | + /** | |
| 46 | + * Check if a value already exists in entry fields for a specific field. | |
| 47 | + * | |
| 48 | + * @param int $formId | |
| 49 | + * @param int $fieldId | |
| 50 | + * @param string $value | |
| 51 | + * @return bool | |
| 52 | + */ | |
| 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; | |
| 35 | 91 | } |