Bicycle/App/Repositories/AccountRateRepository.php
Egor Isaev 69ce89a695 dev
2026-08-11 17:05:39 +03:00

37 lines
1.1 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
/**
* @package Bicycle
* @author Egor Isaev
* @description AccountRateRepository.php
* @copyright (c) 11/08/2026
*/
namespace App\Repositories;
use System\Classes\Repository;
/**
* Репозиторий таблицы account_rates (история процентных ставок savings-счёта).
*/
class AccountRateRepository extends Repository
{
/**
* @param string|null $connection Имя подключения (Database::instance($connection)); null — по умолчанию
*/
public function __construct(?string $connection = null)
{
parent::__construct('account_rates', connection: $connection);
}
/**
* Текущая ставка счёта (запись с valid_to IS NULL — см. бюджет_текущий_план.md).
*
* @param int $account_id
* @return object|false|null Строка account_rates | false, если не найдено | null (не бывает — $where не пуст)
*/
public function getCurrentRate(int $account_id): mixed
{
return $this->getItemWhere("account_id = $account_id AND valid_to IS NULL");
}
}