Add missing method.

This commit is contained in:
James Cole 2023-10-28 18:08:43 +02:00
parent fa31483b02
commit c9fefcd8f4
No known key found for this signature in database
GPG Key ID: B49A324B7EAD6D80
3 changed files with 17 additions and 2 deletions

View File

@ -239,6 +239,14 @@ class CurrencyRepository implements CurrencyRepositoryInterface
$currency->save();
}
/**
* @inheritDoc
*/
public function findByName(string $name): ?TransactionCurrency
{
return TransactionCurrency::where('name', $name)->first();
}
/**
* Find by object, ID or code. Returns user default or system default.
*

View File

@ -84,6 +84,13 @@ interface CurrencyRepositoryInterface
*/
public function findByCode(string $currencyCode): ?TransactionCurrency;
/**
* @param string $name
*
* @return TransactionCurrency|null
*/
public function findByName(string $name): ?TransactionCurrency;
/**
* Find by object, ID or code. Returns user default or system default.
*

View File

@ -1536,9 +1536,9 @@ class OperatorQuerySearch implements SearchInterface
$parts = explode(' ', $value);
$value = trim($parts[count($parts) - 1], "() \t\n\r\0\x0B");
}
$result = $this->currencyRepository->findByCodeNull($value);
$result = $this->currencyRepository->findByCode($value);
if (null === $result) {
$result = $this->currencyRepository->findByNameNull($value);
$result = $this->currencyRepository->findByName($value);
}
return $result;