Files
firefly-iii/app/Repositories/TransactionGroup/TransactionGroupRepositoryInterface.php

127 lines
3.7 KiB
PHP
Raw Normal View History

2019-03-25 15:14:09 +01:00
<?php
2019-03-25 15:14:09 +01:00
/**
* TransactionGroupRepositoryInterface.php
2020-02-16 14:00:57 +01:00
* Copyright (c) 2019 james@firefly-iii.org
2019-03-25 15:14:09 +01:00
*
* This file is part of Firefly III (https://github.com/firefly-iii).
2019-03-25 15:14:09 +01:00
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
2019-03-25 15:14:09 +01:00
*
* This program is distributed in the hope that it will be useful,
2019-03-25 15:14:09 +01:00
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
2019-03-25 15:14:09 +01:00
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
2019-03-25 15:14:09 +01:00
*/
declare(strict_types=1);
namespace FireflyIII\Repositories\TransactionGroup;
use FireflyIII\Enums\UserRoleEnum;
use FireflyIII\Exceptions\DuplicateTransactionException;
2020-03-15 08:16:16 +01:00
use FireflyIII\Exceptions\FireflyException;
2021-02-16 10:19:20 +01:00
use FireflyIII\Models\Location;
use FireflyIII\Models\TransactionGroup;
use FireflyIII\Models\UserGroup;
2019-03-25 15:14:09 +01:00
use FireflyIII\Support\NullArrayObject;
use FireflyIII\User;
use Illuminate\Contracts\Auth\Authenticatable;
2020-04-07 18:19:29 +02:00
use Illuminate\Support\Collection;
2019-03-25 15:14:09 +01:00
/**
* Interface TransactionGroupRepositoryInterface
*
* @method setUserGroup(UserGroup $group)
* @method getUserGroup()
* @method getUser()
* @method checkUserGroupAccess(UserRoleEnum $role)
* @method setUser(null|Authenticatable|User $user)
* @method setUserGroupById(int $userGroupId)
2019-03-25 15:14:09 +01:00
*/
interface TransactionGroupRepositoryInterface
{
2022-03-29 14:59:58 +02:00
public function countAttachments(int $journalId): int;
2025-06-01 14:00:35 +02:00
/**
* Small method that returns a hash that can be used to compare two transaction groups.
*/
public function getCompareHash(TransactionGroup $group): string;
2019-08-27 07:26:32 +02:00
public function destroy(TransactionGroup $group): void;
2020-02-08 06:42:07 +01:00
/**
* Return a group and expand all meta data etc.
*/
public function expandGroup(TransactionGroup $group): array;
2019-08-27 07:26:32 +02:00
/**
* Find a transaction group by its ID.
2019-04-16 16:20:46 +02:00
*/
2019-08-27 07:26:32 +02:00
public function find(int $groupId): ?TransactionGroup;
2019-04-16 16:20:46 +02:00
2019-08-01 06:22:07 +02:00
/**
2019-08-27 07:26:32 +02:00
* Return all attachments for all journals in the group.
2019-08-01 06:22:07 +02:00
*/
2019-08-27 07:26:32 +02:00
public function getAttachments(TransactionGroup $group): array;
2019-08-01 06:22:07 +02:00
2019-04-16 16:20:46 +02:00
/**
* Return all journal links for all journals in the group.
*/
public function getLinks(TransactionGroup $group): array;
2021-03-12 06:20:01 +01:00
/**
* Get the location of a journal or NULL.
*/
public function getLocation(int $journalId): ?Location;
2019-03-25 15:14:09 +01:00
/**
* Return object with all found meta field things as Carbon objects.
*/
public function getMetaDateFields(int $journalId, array $fields): NullArrayObject;
/**
* Return object with all found meta field things.
*/
public function getMetaFields(int $journalId, array $fields): NullArrayObject;
/**
* Get the note text for a journal (by ID).
*/
public function getNoteText(int $journalId): ?string;
2019-04-16 16:20:46 +02:00
/**
* Return all piggy bank events for all journals in the group.
*/
public function getPiggyEvents(TransactionGroup $group): array;
2019-03-25 15:14:09 +01:00
/**
2021-03-12 06:20:01 +01:00
* Get the tags for a journal (by ID) as Tag objects.
2019-03-25 15:14:09 +01:00
*/
2021-03-12 06:20:01 +01:00
public function getTagObjects(int $journalId): Collection;
2020-04-07 18:19:29 +02:00
/**
2021-03-12 06:20:01 +01:00
* Get the tags for a journal (by ID).
2020-04-07 18:19:29 +02:00
*/
2021-03-12 06:20:01 +01:00
public function getTags(int $journalId): array;
2020-04-07 18:19:29 +02:00
/**
* Create a new transaction group.
*
* @throws DuplicateTransactionException
2020-03-15 08:16:16 +01:00
* @throws FireflyException
*/
public function store(array $data): TransactionGroup;
/**
* Update an existing transaction group.
*/
public function update(TransactionGroup $transactionGroup, array $data): TransactionGroup;
2019-08-17 12:09:03 +02:00
}