# ivyforms/0.2/backend/src/Repository/BaseRepositoryInterface.php

The Innovative Form Builder – IvyForms, version 0.2. 94 lines.

- Page: https://pluginprobe.com/plugins/ivyforms/0.2/code/backend/src/Repository/BaseRepositoryInterface.php
- Raw: https://pluginprobe.com/plugins/ivyforms/0.2/raw/backend/src/Repository/BaseRepositoryInterface.php
- Modified: 2025-07-24T13:31:58+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/ivyforms/0.2/code/backend/src/Repository/BaseRepositoryInterface.php#L10-L20`.

```php
<?php

namespace IvyForms\Repository;

// phpcs:disable PSR1.Files.SideEffects
if (!defined('ABSPATH')) {
    exit; // Exit if accessed directly
}

/**
 * Interface BaseRepositoryInterface
 *
 * @package IvyForms\Repository
 */
interface BaseRepositoryInterface
{
    /**
     * Get an entity by ID.
     *
     * @param int $id
     *
     * @return object|null
     */
    public function getById(int $id): ?object;

    /**
     * Get all entities.
     *
     * @return mixed[]|null
    */
    public function getAll(): ?array;

    /**
     * Add an entity.
     *
     * @param object $entity
     * @return int
     */
    public function add(object $entity): int;

    /**
     * Update an entity by ID.
     *
     * @param int $id
     * @param object $entity
     * @return bool
     */
    public function update(int $id, object $entity): bool;

    /**
     * Delete an entity by ID.
     *
     * @param int $id
     * @return int
     */
    public function delete(int $id): int;

    /**
     * Search for entities based on parameters.
     *
     * @param array<string, mixed> $params
     * @return array<mixed>
     */
    public function search(array $params): array;

    /**
     * Select query for retrieving data.
     *
     * @return string
     */
    public function selectQuery(): string;

    /**
     * Begin a database transaction.
     *
     * @return bool
     */
    public function beginTransaction(): bool;

    /**
     * Commit a database transaction.
     *
     * @return bool
     */
    public function commit(): bool;

    /**
     * Rollback a database transaction.
     *
     * @return bool
     */
    public function rollback(): bool;
}

```
