Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement RepositoryInterface and RepositoryTrait #344

Open
Tigrov opened this issue May 24, 2024 · 1 comment
Open

Implement RepositoryInterface and RepositoryTrait #344

Tigrov opened this issue May 24, 2024 · 1 comment

Comments

@Tigrov
Copy link
Member

Tigrov commented May 24, 2024

interface RepositoryInterface
{
    public static function find(array|string $condition = []): ActiveQueryInterface;
    public static function findBySql(string $sql, array $params = []): ActiveQueryInterface;

    public static function findOne(array|string $condition = []): ActiveRecordInterface|null;
    public static function findAll(array|string $condition = []): array;

    public static function deleteAll(array|string $condition = [], array $params = []): int;
    public static function updateAll(array $attributes, array|string $condition = [], array $params = []): int;
    public static function updateAllCounters(array $counters, array|string $condition = '', array $params = []): int;
}

interface  ConnectionProviderInterface
{
    public static function getDb(): ConnectionInterface;
    public static function setDb(ConnectionInterface $db): void;
}
@Tigrov Tigrov mentioned this issue May 24, 2024
13 tasks
@xepozz
Copy link
Member

xepozz commented Jun 9, 2024

ConnectionProviderInterface could be also bound to the AR factory and have non-static methods
Also I think there're no need to add interface for the ConnectionProvider, it could be implemented as a single file with get/set methods

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants