Files
firefly-iii/app/Repositories/Journal/JournalCLIRepositoryInterface.php

93 lines
2.9 KiB
PHP
Raw Normal View History

<?php
/**
* JournalCLIRepositoryInterface.php
2020-02-16 14:00:57 +01:00
* Copyright (c) 2019 james@firefly-iii.org
*
* This file is part of Firefly III (https://github.com/firefly-iii).
*
* 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.
*
* This program is distributed in the hope that it will be useful,
* 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.
*
* 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-08-17 12:09:03 +02:00
declare(strict_types=1);
namespace FireflyIII\Repositories\Journal;
2019-08-10 14:41:08 +02:00
use Carbon\Carbon;
use FireflyIII\Enums\UserRoleEnum;
2019-08-10 14:41:08 +02:00
use FireflyIII\Models\TransactionJournal;
use FireflyIII\Models\UserGroup;
use FireflyIII\User;
use Illuminate\Contracts\Auth\Authenticatable;
2019-08-10 14:41:08 +02:00
use Illuminate\Support\Collection;
/**
* Interface JournalCLIRepositoryInterface
*
* @method setUserGroup(UserGroup $group)
* @method getUserGroup()
* @method getUser()
* @method checkUserGroupAccess(UserRoleEnum $role)
* @method setUser(null|Authenticatable|User $user)
* @method setUserGroupById(int $userGroupId)
*/
interface JournalCLIRepositoryInterface
{
/**
2021-03-12 06:20:01 +01:00
* Get all transaction journals with a specific type, regardless of user.
*/
2021-03-12 06:20:01 +01:00
public function getAllJournals(array $types): Collection;
2019-08-10 14:41:08 +02:00
/**
2021-03-12 06:20:01 +01:00
* Return the ID of the budget linked to the journal (if any) or the transactions (if any).
2019-08-10 14:41:08 +02:00
*/
2021-03-12 06:20:01 +01:00
public function getJournalBudgetId(TransactionJournal $journal): int;
2019-08-10 14:41:08 +02:00
/**
2021-03-12 06:20:01 +01:00
* Return the ID of the category linked to the journal (if any) or to the transactions (if any).
2019-08-10 14:41:08 +02:00
*/
2021-03-12 06:20:01 +01:00
public function getJournalCategoryId(TransactionJournal $journal): int;
2019-08-10 14:41:08 +02:00
/**
2021-03-12 06:20:01 +01:00
* Return all journals without a group, used in an upgrade routine.
2019-08-10 14:41:08 +02:00
*/
2021-03-12 06:20:01 +01:00
public function getJournalsWithoutGroup(): array;
2019-08-10 14:41:08 +02:00
/**
2021-03-12 06:20:01 +01:00
* Return Carbon value of a meta field (or NULL).
2019-08-10 14:41:08 +02:00
*/
2021-03-12 06:20:01 +01:00
public function getMetaDate(TransactionJournal $journal, string $field): ?Carbon;
2019-08-10 14:41:08 +02:00
/**
2021-03-12 06:20:01 +01:00
* Return value of a meta field (or NULL).
2019-08-10 14:41:08 +02:00
*/
2021-03-12 06:20:01 +01:00
public function getMetaField(TransactionJournal $journal, string $field): ?string;
2019-08-10 14:41:08 +02:00
/**
2021-03-12 06:20:01 +01:00
* Return text of a note attached to journal, or NULL
2019-08-10 14:41:08 +02:00
*/
2021-03-12 06:20:01 +01:00
public function getNoteText(TransactionJournal $journal): ?string;
2019-08-10 14:41:08 +02:00
/**
2021-03-12 06:20:01 +01:00
* Returns all journals with more than 2 transactions. Should only return empty collections
* in Firefly III > v4.8,0.
2019-08-10 14:41:08 +02:00
*/
2021-03-12 06:20:01 +01:00
public function getSplitJournals(): Collection;
2019-08-10 14:41:08 +02:00
/**
2021-03-12 06:20:01 +01:00
* Return all tags as strings in an array.
2019-08-10 14:41:08 +02:00
*/
2021-03-12 06:20:01 +01:00
public function getTags(TransactionJournal $journal): array;
2019-08-17 12:09:03 +02:00
}