| @@ -1,22 +1,18 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | /** |
| 4 | - * @copyright © TMS-Plugins. All rights reserved. | |
| 4 | + * @copyright © Melograno Venture Studio. All rights reserved. | |
| 5 | 5 | * @licence See LICENCE.md for license details. |
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | 8 | namespace IvyForms\Repository; |
| 9 | 9 | |
| 10 | -// phpcs:disable PSR1.Files.SideEffects | |
| 11 | -if (!defined('ABSPATH')) { | |
| 12 | - exit; // Exit if accessed directly | |
| 13 | -} | |
| 14 | - | |
| 15 | 10 | use IvyForms\Common\Exceptions\InvalidArgumentException; |
| 16 | 11 | use IvyForms\Common\Exceptions\NotFoundException; |
| 17 | 12 | use IvyForms\Common\Exceptions\QueryExecutionException; |
| 18 | 13 | use IvyForms\Services\Translations\BackendStrings; |
| 14 | +use IvyForms\Repository\ColumnRepositoryTrait; | |
| 19 | 15 | |
| 20 | 16 | /** |
| 21 | 17 | * Class AbstractRepository |
| 22 | 18 | * |
| @@ -23,8 +19,10 @@ | ||
| 23 | 19 | * @package IvyForms\Repository |
| 24 | 20 | */ |
| 25 | 21 | class AbstractRepository |
| 26 | 22 | { |
| 23 | + use ColumnRepositoryTrait; | |
| 24 | + | |
| 27 | 25 | public const FACTORY = ''; |
| 28 | 26 | |
| 29 | 27 | /** @var string */ |
| 30 | 28 | protected string $table; |
| @@ -388,49 +386,6 @@ | ||
| 388 | 386 | */ |
| 389 | 387 | public function rollback(): bool |
| 390 | 388 | { |
| 391 | 389 | return (bool) $this->wpdb->query('ROLLBACK'); |
| 392 | - } | |
| 393 | - | |
| 394 | - /** | |
| 395 | - * @return string[] | |
| 396 | - */ | |
| 397 | - protected function getSearchableColumns(): array | |
| 398 | - { | |
| 399 | - return ['id']; | |
| 400 | - } | |
| 401 | - | |
| 402 | - /** | |
| 403 | - * @return array<string, string> | |
| 404 | - */ | |
| 405 | - protected function getFilterableColumns(): array | |
| 406 | - { | |
| 407 | - return []; | |
| 408 | - } | |
| 409 | - | |
| 410 | - /** | |
| 411 | - * @return string[] | |
| 412 | - */ | |
| 413 | - protected function getSortableColumns(): array | |
| 414 | - { | |
| 415 | - return ['id']; | |
| 416 | - } | |
| 417 | - | |
| 418 | - /** | |
| 419 | - * @return string | |
| 420 | - */ | |
| 421 | - protected function getDateColumn(): string | |
| 422 | - { | |
| 423 | - return 'dateCreated'; | |
| 424 | - } | |
| 425 | - | |
| 426 | - /** | |
| 427 | - * Get allowed foreign key columns for deletion operations. | |
| 428 | - * Override this method in child repositories to specify allowed columns. | |
| 429 | - * | |
| 430 | - * @return string[] | |
| 431 | - */ | |
| 432 | - protected function getAllowedForeignColumns(): array | |
| 433 | - { | |
| 434 | - return ['formId', 'entryId', 'fieldId']; | |
| 435 | 390 | } |
| 436 | 391 | } |