| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* @copyright © Melograno Venture Studio. All rights. |
| 5 |
* @licence See LICENCE.md for license details. |
| 6 |
*/ |
| 7 |
|
| 8 |
namespace IvyForms\Repository\FieldOptions; |
| 9 |
|
| 10 |
// phpcs:disable PSR1.Files.SideEffects |
| 11 |
if (!defined('ABSPATH')) { |
| 12 |
exit; // Exit if accessed directly |
| 13 |
} |
| 14 |
|
| 15 |
use IvyForms\Entity\FieldOptions\FieldOptions; |
| 16 |
use IvyForms\Repository\BaseRepositoryInterface; |
| 17 |
|
| 18 |
interface FieldOptionsRepositoryInterface extends BaseRepositoryInterface |
| 19 |
{ |
| 20 |
/** |
| 21 |
* Add a FieldOptions entity. |
| 22 |
* @param object $entity |
| 23 |
* @return int |
| 24 |
*/ |
| 25 |
public function add(object $entity): int; |
| 26 |
|
| 27 |
/** |
| 28 |
* Update a FieldOptions entity by ID. |
| 29 |
* @param int $id |
| 30 |
* @param object $entity |
| 31 |
* @return bool |
| 32 |
*/ |
| 33 |
public function update(int $id, object $entity): bool; |
| 34 |
|
| 35 |
/** |
| 36 |
* Delete all options by field ID. |
| 37 |
* @param int $fieldId |
| 38 |
* @return bool |
| 39 |
*/ |
| 40 |
public function deleteByFieldId(int $fieldId): bool; |
| 41 |
|
| 42 |
/** |
| 43 |
* Get all options by field ID. |
| 44 |
* @param int $fieldId |
| 45 |
* @return array<int, FieldOptions> |
| 46 |
*/ |
| 47 |
public function getByFieldId(int $fieldId): array; |
| 48 |
|
| 49 |
/** |
| 50 |
* Bulk delete all options for multiple field IDs. |
| 51 |
* @param array<int> $fieldIds |
| 52 |
* @return int Number of deleted rows |
| 53 |
*/ |
| 54 |
public function deleteByFieldIds(array $fieldIds): int; |
| 55 |
|
| 56 |
/** |
| 57 |
* Bulk delete all options for multiple field IDs based on specific column values. |
| 58 |
* @param string $columnName |
| 59 |
* @param array<int> $values |
| 60 |
* @return int Number of deleted rows |
| 61 |
*/ |
| 62 |
public function deleteByFieldIdsByColumnValues(string $columnName, array $values): int; |
| 63 |
|
| 64 |
/** |
| 65 |
* Batch add FieldOptions entities. |
| 66 |
* @param array<object> $entities |
| 67 |
* @return array<int> Inserted IDs |
| 68 |
*/ |
| 69 |
public function addMany(array $entities): array; |
| 70 |
|
| 71 |
/** |
| 72 |
* Batch update FieldOptions entities by ID. |
| 73 |
* @param array<object> $entities |
| 74 |
* @return int Number of updated rows |
| 75 |
*/ |
| 76 |
public function updateMany(array $entities): int; |
| 77 |
|
| 78 |
/** |
| 79 |
* Bulk delete options by their own IDs (not field IDs). |
| 80 |
* @param array<int> $optionIds |
| 81 |
* @return int Number of deleted rows |
| 82 |
*/ |
| 83 |
public function deleteByOptionIds(array $optionIds): int; |
| 84 |
} |
| 85 |
|