← All changes
|
backend/src/Repository/Field/FieldRepositoryInterface.php
+56
-0
0.6.1
→
1.5
View file →
| @@ -1,0 +1,56 @@ | ||
| 1 | +<?php | |
| 2 | + | |
| 3 | +namespace IvyForms\Repository\Field; | |
| 4 | + | |
| 5 | +// phpcs:disable PSR1.Files.SideEffects | |
| 6 | +if (!defined('ABSPATH')) { | |
| 7 | + exit; // Exit if accessed directly | |
| 8 | +} | |
| 9 | + | |
| 10 | +use IvyForms\Repository\BaseRepositoryInterface; | |
| 11 | + | |
| 12 | +interface FieldRepositoryInterface extends BaseRepositoryInterface | |
| 13 | +{ | |
| 14 | + /** | |
| 15 | + * Get all fields by specific form ID. | |
| 16 | + * | |
| 17 | + * @param int $id | |
| 18 | + * | |
| 19 | + * @return mixed[]|null The array of entities | |
| 20 | + */ | |
| 21 | + public function getFieldsById(int $id): ?array; | |
| 22 | + | |
| 23 | + /** | |
| 24 | + * Get multiple fields by their IDs in a single query. | |
| 25 | + * | |
| 26 | + * @param int[] $fieldIds | |
| 27 | + * @return array<int, object> Indexed by field ID | |
| 28 | + */ | |
| 29 | + public function getFieldsByIds(array $fieldIds): array; | |
| 30 | + | |
| 31 | + /** | |
| 32 | + * Delete multiple fields by their IDs in a single query. | |
| 33 | + * | |
| 34 | + * @param int[] $ids | |
| 35 | + * @return int Number of deleted rows | |
| 36 | + */ | |
| 37 | + public function deleteMany(array $ids): int; | |
| 38 | + | |
| 39 | + /** | |
| 40 | + * Delete multiple fields by foreign key values (formId). | |
| 41 | + * | |
| 42 | + * @param array<int> $formIds | |
| 43 | + * @param string $foreignColumn | |
| 44 | + * @return int Number of deleted fields | |
| 45 | + */ | |
| 46 | + public function deleteManyByForeignKeyValues(array $formIds, string $foreignColumn = 'formId'): int; | |
| 47 | + | |
| 48 | + /** | |
| 49 | + * Delete fields by a single foreign key value (formId). | |
| 50 | + * | |
| 51 | + * @param int $formId | |
| 52 | + * @param string $foreignColumn | |
| 53 | + * @return int Number of deleted fields | |
| 54 | + */ | |
| 55 | + public function deleteOneByForeignKeyValue(int $formId, string $foreignColumn = 'formId'): int; | |
| 56 | +} | |