src/Money/Module/Home/Controller/Home.php
public function index()
    {
        $accountsBudgets = array();

        $date = new \DateTimeImmutable(date('Y-m-01'));

        //~ Verify if account is for current user, else throw error 500
        $accountMapper = new AccountMapper(Database::get('money'));
        $accounts = $accountMapper->findAllMainAccountByUserId(Session::getInstance()->get('id'));

        foreach ($accounts as $account) {
            $budgetMapper = new BudgetMapper(Database::get('money'));
            $budgets      = $budgetMapper->findAllByDate($account, $date);
            $accountsBudgets[$account->getId()] = array('account' => $account, 'budgets' => $budgets);
        }

        $this->dataCollection->add('title', 'Monthly report');
        $this->dataCollection->add('accounts', $accounts);
        $this->dataCollection->add('accountsBudgets', $accountsBudgets);


        return $this->getResponse('Home');
    }
public function index()
    {
        $accountsBudgets = array();

        $date = new \DateTimeImmutable(date('Y-m-01'));

        //~ Verify if account is for current user, else throw error 500
        $accountMapper = new AccountMapper(Database::get('money'));
        $accounts = $accountMapper->findAllMainAccountByUserId(Session::getInstance()->get('id'));

        foreach ($accounts as $account) {
            $budgetMapper = new BudgetMapper(Database::get('money'));
            $budgets      = $budgetMapper->findAllByDate($account, $date);
            $accountsBudgets[$account->getId()] = array('account' => $account, 'budgets' => $budgets);
        }

        $this->dataCollection->add('title', 'Monthly report');
        $this->dataCollection->add('accounts', $accounts);
        $this->dataCollection->add('accountsBudgets', $accountsBudgets);


        return $this->getResponse('Home');
    }
Main controller action.

@return Template