mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-02 12:15:55 +00:00
Expand tests and API code.
This commit is contained in:
@@ -107,7 +107,7 @@ class JournalRepository implements JournalRepositoryInterface
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function delete(TransactionJournal $journal): bool
|
||||
public function destroy(TransactionJournal $journal): bool
|
||||
{
|
||||
$journal->delete();
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ interface JournalRepositoryInterface
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function delete(TransactionJournal $journal): bool;
|
||||
public function destroy(TransactionJournal $journal): bool;
|
||||
|
||||
/**
|
||||
* Find a specific journal.
|
||||
|
||||
@@ -163,6 +163,26 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface
|
||||
return new PiggyBank();
|
||||
}
|
||||
|
||||
/**
|
||||
* Find by name or return NULL.
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return PiggyBank|null
|
||||
*/
|
||||
public function findByName(string $name): ?PiggyBank
|
||||
{
|
||||
$set = $this->user->piggyBanks()->get(['piggy_banks.*']);
|
||||
/** @var PiggyBank $piggy */
|
||||
foreach ($set as $piggy) {
|
||||
if ($piggy->name === $name) {
|
||||
return $piggy;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get current amount saved in piggy bank.
|
||||
*
|
||||
|
||||
@@ -102,6 +102,15 @@ interface PiggyBankRepositoryInterface
|
||||
*/
|
||||
public function find(int $piggyBankid): PiggyBank;
|
||||
|
||||
/**
|
||||
* Find by name or return NULL.
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return PiggyBank|null
|
||||
*/
|
||||
public function findByName(string $name): ?PiggyBank;
|
||||
|
||||
/**
|
||||
* Get current amount saved in piggy bank.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user