2015-02-09 00:23:39 -06:00
|
|
|
<?php
|
2016-05-20 05:41:23 -05:00
|
|
|
/**
|
|
|
|
* JournalRepositoryInterface.php
|
|
|
|
* Copyright (C) 2016 thegrumpydictator@gmail.com
|
|
|
|
*
|
2016-10-04 23:52:15 -05:00
|
|
|
* This software may be modified and distributed under the terms of the
|
|
|
|
* Creative Commons Attribution-ShareAlike 4.0 International License.
|
|
|
|
*
|
|
|
|
* See the LICENSE file for details.
|
2016-05-20 05:41:23 -05:00
|
|
|
*/
|
|
|
|
|
2017-03-24 09:01:53 -05:00
|
|
|
declare(strict_types=1);
|
2015-02-09 00:23:39 -06:00
|
|
|
|
|
|
|
namespace FireflyIII\Repositories\Journal;
|
|
|
|
|
2016-10-30 00:14:07 -05:00
|
|
|
use FireflyIII\Models\Account;
|
2015-04-07 11:26:14 -05:00
|
|
|
use FireflyIII\Models\TransactionJournal;
|
2016-10-30 00:14:07 -05:00
|
|
|
use FireflyIII\Models\TransactionType;
|
2017-01-30 09:40:49 -06:00
|
|
|
use FireflyIII\User;
|
2017-01-20 12:50:22 -06:00
|
|
|
use Illuminate\Support\Collection;
|
2016-10-30 00:14:07 -05:00
|
|
|
use Illuminate\Support\MessageBag;
|
2015-02-09 00:23:39 -06:00
|
|
|
|
2015-02-11 00:35:10 -06:00
|
|
|
/**
|
|
|
|
* Interface JournalRepositoryInterface
|
|
|
|
*
|
|
|
|
* @package FireflyIII\Repositories\Journal
|
|
|
|
*/
|
|
|
|
interface JournalRepositoryInterface
|
|
|
|
{
|
2015-04-11 12:59:41 -05:00
|
|
|
/**
|
2015-05-05 00:28:04 -05:00
|
|
|
* @param TransactionJournal $journal
|
2016-11-05 05:47:21 -05:00
|
|
|
* @param TransactionType $type
|
2016-11-05 12:43:18 -05:00
|
|
|
* @param Account $source
|
|
|
|
* @param Account $destination
|
2015-04-11 12:59:41 -05:00
|
|
|
*
|
2016-11-05 05:47:21 -05:00
|
|
|
* @return MessageBag
|
2015-04-11 12:59:41 -05:00
|
|
|
*/
|
2016-11-05 05:47:21 -05:00
|
|
|
public function convert(TransactionJournal $journal, TransactionType $type, Account $source, Account $destination): MessageBag;
|
2015-04-11 12:59:41 -05:00
|
|
|
|
2016-10-30 00:14:07 -05:00
|
|
|
/**
|
2016-11-05 05:47:21 -05:00
|
|
|
* Deletes a journal.
|
|
|
|
*
|
2016-10-30 00:14:07 -05:00
|
|
|
* @param TransactionJournal $journal
|
|
|
|
*
|
2016-11-05 05:47:21 -05:00
|
|
|
* @return bool
|
2016-10-30 00:14:07 -05:00
|
|
|
*/
|
2016-11-05 05:47:21 -05:00
|
|
|
public function delete(TransactionJournal $journal): bool;
|
2016-10-30 00:14:07 -05:00
|
|
|
|
2016-04-23 02:33:54 -05:00
|
|
|
/**
|
2016-05-01 02:42:08 -05:00
|
|
|
* Find a specific journal
|
|
|
|
*
|
2016-04-23 02:33:54 -05:00
|
|
|
* @param int $journalId
|
|
|
|
*
|
|
|
|
* @return TransactionJournal
|
|
|
|
*/
|
2016-12-04 11:02:19 -06:00
|
|
|
public function find(int $journalId): TransactionJournal;
|
2016-04-23 02:33:54 -05:00
|
|
|
|
2015-05-04 16:46:14 -05:00
|
|
|
/**
|
2016-05-01 02:42:08 -05:00
|
|
|
* Get users very first transaction journal
|
2015-05-04 16:46:14 -05:00
|
|
|
*
|
|
|
|
* @return TransactionJournal
|
|
|
|
*/
|
2016-04-06 02:27:45 -05:00
|
|
|
public function first(): TransactionJournal;
|
2015-05-04 16:46:14 -05:00
|
|
|
|
2017-01-30 09:46:30 -06:00
|
|
|
/**
|
|
|
|
* @return Collection
|
|
|
|
*/
|
|
|
|
public function getTransactionTypes(): Collection;
|
|
|
|
|
2017-03-24 09:01:53 -05:00
|
|
|
/**
|
|
|
|
* @param TransactionJournal $journal
|
|
|
|
* @param int $order
|
|
|
|
*
|
|
|
|
* @return bool
|
|
|
|
*/
|
|
|
|
public function setOrder(TransactionJournal $journal, int $order): bool;
|
|
|
|
|
2017-01-30 09:46:30 -06:00
|
|
|
/**
|
|
|
|
* @param User $user
|
|
|
|
*/
|
|
|
|
public function setUser(User $user);
|
2016-05-15 05:08:41 -05:00
|
|
|
|
2015-02-24 15:53:38 -06:00
|
|
|
/**
|
|
|
|
* @param array $data
|
|
|
|
*
|
|
|
|
* @return TransactionJournal
|
|
|
|
*/
|
2016-04-06 02:27:45 -05:00
|
|
|
public function store(array $data): TransactionJournal;
|
2015-02-09 00:23:39 -06:00
|
|
|
|
2015-02-25 14:19:06 -06:00
|
|
|
/**
|
|
|
|
* @param TransactionJournal $journal
|
2015-02-27 07:27:04 -06:00
|
|
|
* @param array $data
|
2015-02-25 14:19:06 -06:00
|
|
|
*
|
2016-04-06 02:27:45 -05:00
|
|
|
* @return TransactionJournal
|
2015-02-25 14:19:06 -06:00
|
|
|
*/
|
2016-04-06 02:27:45 -05:00
|
|
|
public function update(TransactionJournal $journal, array $data): TransactionJournal;
|
2015-04-28 10:10:52 -05:00
|
|
|
|
2016-10-21 14:41:31 -05:00
|
|
|
/**
|
|
|
|
* @param TransactionJournal $journal
|
|
|
|
* @param array $data
|
|
|
|
*
|
|
|
|
* @return TransactionJournal
|
|
|
|
*/
|
|
|
|
public function updateSplitJournal(TransactionJournal $journal, array $data): TransactionJournal;
|
|
|
|
|
2015-03-29 01:14:32 -05:00
|
|
|
}
|