mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-01-06 14:12:15 +00:00
Update find methods to return null
This commit is contained in:
@@ -129,6 +129,18 @@ class CurrencyRepository implements CurrencyRepositoryInterface
|
||||
return $currency;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find by currency code, return NULL if unfound.
|
||||
*
|
||||
* @param string $currencyCode
|
||||
*
|
||||
* @return TransactionCurrency|null
|
||||
*/
|
||||
public function findByCodeNull(string $currencyCode): ?TransactionCurrency
|
||||
{
|
||||
return TransactionCurrency::where('code', $currencyCode)->first();
|
||||
}
|
||||
|
||||
/**
|
||||
* Find by currency name.
|
||||
*
|
||||
@@ -163,6 +175,21 @@ class CurrencyRepository implements CurrencyRepositoryInterface
|
||||
return $currency;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find by ID, return NULL if not found.
|
||||
*
|
||||
* @param int $currencyId
|
||||
*
|
||||
* @return TransactionCurrency|null
|
||||
*/
|
||||
public function findNull(int $currencyId): ?TransactionCurrency
|
||||
{
|
||||
/** @var TransactionCurrency $res */
|
||||
$res = TransactionCurrency::find($currencyId);
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection
|
||||
*/
|
||||
|
||||
@@ -60,6 +60,7 @@ interface CurrencyRepositoryInterface
|
||||
*
|
||||
* @param int $currencyId
|
||||
*
|
||||
* @deprecated
|
||||
* @return TransactionCurrency
|
||||
*/
|
||||
public function find(int $currencyId): TransactionCurrency;
|
||||
@@ -67,12 +68,23 @@ interface CurrencyRepositoryInterface
|
||||
/**
|
||||
* Find by currency code.
|
||||
*
|
||||
* @deprecated
|
||||
*
|
||||
* @param string $currencyCode
|
||||
*
|
||||
* @return TransactionCurrency
|
||||
*/
|
||||
public function findByCode(string $currencyCode): TransactionCurrency;
|
||||
|
||||
/**
|
||||
* Find by currency code, return NULL if unfound.
|
||||
*
|
||||
* @param string $currencyCode
|
||||
*
|
||||
* @return TransactionCurrency|null
|
||||
*/
|
||||
public function findByCodeNull(string $currencyCode): ?TransactionCurrency;
|
||||
|
||||
/**
|
||||
* Find by currency name.
|
||||
*
|
||||
@@ -91,6 +103,15 @@ interface CurrencyRepositoryInterface
|
||||
*/
|
||||
public function findBySymbol(string $currencySymbol): TransactionCurrency;
|
||||
|
||||
/**
|
||||
* Find by ID, return NULL if not found.
|
||||
*
|
||||
* @param int $currencyId
|
||||
*
|
||||
* @return TransactionCurrency|null
|
||||
*/
|
||||
public function findNull(int $currencyId): ?TransactionCurrency;
|
||||
|
||||
/**
|
||||
* @return Collection
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user