← All changes
|
backend/src/Repository/Entry/EntryRepositoryInterface.php
+79
-0
0.6.1
→
1.5
View file →
| @@ -1,0 +1,79 @@ | ||
| 1 | +<?php | |
| 2 | + | |
| 3 | +namespace IvyForms\Repository\Entry; | |
| 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 EntryRepositoryInterface extends BaseRepositoryInterface | |
| 13 | +{ | |
| 14 | + /** | |
| 15 | + * Check if an entry exists in the database. | |
| 16 | + * | |
| 17 | + * @param int $entryId | |
| 18 | + * @return bool | |
| 19 | + */ | |
| 20 | + public function exists(int $entryId): bool; | |
| 21 | + | |
| 22 | + /** | |
| 23 | + * Get the count of entries for a specific form. | |
| 24 | + * | |
| 25 | + * @param int $formId | |
| 26 | + * @return int | |
| 27 | + */ | |
| 28 | + public function getCountByFormId(int $formId): int; | |
| 29 | + | |
| 30 | + /** | |
| 31 | + * Get the count of entries for multiple form IDs. | |
| 32 | + * | |
| 33 | + * @param int[] $formIds | |
| 34 | + * @return array<int, int> formId => count | |
| 35 | + */ | |
| 36 | + public function getEntryCountByFormIds(array $formIds): array; | |
| 37 | + | |
| 38 | + /** | |
| 39 | + * Get the count of entries for the filter dropdown. | |
| 40 | + * | |
| 41 | + * @param array<string, mixed>|null $params | |
| 42 | + * @return array<string, int> | |
| 43 | + */ | |
| 44 | + public function getFilterCount(?array $params = null): array; | |
| 45 | + | |
| 46 | + /** | |
| 47 | + * Update the starred status of an entry. | |
| 48 | + * | |
| 49 | + * @param int $entryId | |
| 50 | + * @param bool $value | |
| 51 | + * @return void | |
| 52 | + */ | |
| 53 | + public function updateEntryStarred(int $entryId, bool $value): void; | |
| 54 | + | |
| 55 | + /** | |
| 56 | + * Update the status of an entry. | |
| 57 | + * | |
| 58 | + * @param int $entryId | |
| 59 | + * @param string $status | |
| 60 | + * @return void | |
| 61 | + */ | |
| 62 | + public function updateEntryStatus(int $entryId, string $status): void; | |
| 63 | + | |
| 64 | + /** | |
| 65 | + * Get the entries with their fields based on search parameters. | |
| 66 | + * | |
| 67 | + * @param array<int, array<string, mixed>> $entries | |
| 68 | + * @return array<mixed> | |
| 69 | + */ | |
| 70 | + public function getEntryFields(array $entries): array; | |
| 71 | + | |
| 72 | + /** | |
| 73 | + * Resolve owning form IDs for the given entry IDs in a single query. | |
| 74 | + * | |
| 75 | + * @param int[] $entryIds | |
| 76 | + * @return array<int, int> entryId => formId | |
| 77 | + */ | |
| 78 | + public function getFormIdsByEntryIds(array $entryIds): array; | |
| 79 | +} | |