src/Money/DataMapper/Mapper/Money/BudgetMonthMapper.php
protected function checkBudget(Budget $budget, \DateTimeImmutable $date)
    {
        try {

            $this->addWhere('budget_id', $budget->getId());
            $this->addWhere('budget_month_date', $date->format('Y-m-d'));
            $this->selectOne();

        } catch (ExceptionNoData $exception) {

            //~ If not exist, create this budget month
            //$dateNow   = new \DateTimeImmutable();
            $dateStart = new \DateTimeImmutable($budget->getDateStart());
            $dateEnd   = null;
            if (!empty($budget->getDateEnd())) {
                $dateEnd = new \DateTimeImmutable($budget->getDateEnd());
            }

            $isInRecurrence = $budget->isRecurrent() && $dateStart < $date && ($dateEnd === null || $dateEnd >= $date) && $budget->hasMonth((int) $date->format('m'));
            $isFirstMonth   = ($dateStart == $date);

            if ($isInRecurrence || $isFirstMonth) {
                $budgetMonth = $this->newDataInstance();
                $budgetMonth->setBudgetId($budget->getId());
                $budgetMonth->setDate($date->format('Y-m-d'));
                $budgetMonth->setAmount($budget->getAmountDefault());
                $this->insert($budgetMonth);
            }
        }
    }
protected function checkBudget(Budget $budget, \DateTimeImmutable $date)
    {
        try {

            $this->addWhere('budget_id', $budget->getId());
            $this->addWhere('budget_month_date', $date->format('Y-m-d'));
            $this->selectOne();

        } catch (ExceptionNoData $exception) {

            //~ If not exist, create this budget month
            //$dateNow   = new \DateTimeImmutable();
            $dateStart = new \DateTimeImmutable($budget->getDateStart());
            $dateEnd   = null;
            if (!empty($budget->getDateEnd())) {
                $dateEnd = new \DateTimeImmutable($budget->getDateEnd());
            }

            $isInRecurrence = $budget->isRecurrent() && $dateStart < $date && ($dateEnd === null || $dateEnd >= $date) && $budget->hasMonth((int) $date->format('m'));
            $isFirstMonth   = ($dateStart == $date);

            if ($isInRecurrence || $isFirstMonth) {
                $budgetMonth = $this->newDataInstance();
                $budgetMonth->setBudgetId($budget->getId());
                $budgetMonth->setDate($date->format('Y-m-d'));
                $budgetMonth->setAmount($budget->getAmountDefault());
                $this->insert($budgetMonth);
            }
        }
    }
Check for budget

@param Budget             $budget
@param \DateTimeImmutable $date
@return void