src/Money/Module/Transaction/Controller/Transaction.php
public function index()
    {
        //~ Breadcrumb
        $this->breadcrumb->add((new BreadcrumbItem('List'))
            ->setIcon('list')
            ->setIsActive(true));

        $get    = Get::getInstance();
        $params = $this->route->getParameterCollection();

        $account = null;

        $transactions      = array();
        $transactionMapper = new TransactionMapper(Database::get('money'));
        if ($params->hasByName('id')) {

            $account = $this->verifyAccount((int) $params->getByName('id')
                ->getValue());

            if (Server::getInstance()->isPost() && 'upload' === Post::getInstance()->get('action', '')) {
                $this->upload($account);
            }

            $transactionMapper->addWhere('account_id', $account->getId());

            if ($get->has('date_start')) {
                $dateStart = new \DateTime($get->get('date_start'));
                $dateEnd   = new \DateTime($get->get('date_end'));
            } else {
                $dateStart = new \DateTimeImmutable(date('Y-m-01'));
                $dateEnd   = new \DateTimeImmutable(date('Y-m-31'));
            }

            $transactionMapper->addWhere('transaction_date', $dateStart->format('Y-m-d'), '>=');
            $transactionMapper->addWhere('transaction_date', $dateEnd->format('Y-m-d'), '<=');
            $transactionMapper->addOrder('transaction_date');

            $transactions = $transactionMapper->select();
        }

        //~ Content
        $this->dataCollection->add('title', 'Transactions');
        $this->dataCollection->add('transactions', $transactions);
        $this->dataCollection->add('account', $account);

        return $this->getResponse('Transaction');
    }
public function index()
    {
        //~ Breadcrumb
        $this->breadcrumb->add((new BreadcrumbItem('List'))
            ->setIcon('list')
            ->setIsActive(true));

        $get    = Get::getInstance();
        $params = $this->route->getParameterCollection();

        $account = null;

        $transactions      = array();
        $transactionMapper = new TransactionMapper(Database::get('money'));
        if ($params->hasByName('id')) {

            $account = $this->verifyAccount((int) $params->getByName('id')
                ->getValue());

            if (Server::getInstance()->isPost() && 'upload' === Post::getInstance()->get('action', '')) {
                $this->upload($account);
            }

            $transactionMapper->addWhere('account_id', $account->getId());

            if ($get->has('date_start')) {
                $dateStart = new \DateTime($get->get('date_start'));
                $dateEnd   = new \DateTime($get->get('date_end'));
            } else {
                $dateStart = new \DateTimeImmutable(date('Y-m-01'));
                $dateEnd   = new \DateTimeImmutable(date('Y-m-31'));
            }

            $transactionMapper->addWhere('transaction_date', $dateStart->format('Y-m-d'), '>=');
            $transactionMapper->addWhere('transaction_date', $dateEnd->format('Y-m-d'), '<=');
            $transactionMapper->addOrder('transaction_date');

            $transactions = $transactionMapper->select();
        }

        //~ Content
        $this->dataCollection->add('title', 'Transactions');
        $this->dataCollection->add('transactions', $transactions);
        $this->dataCollection->add('account', $account);

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

@return ResponseInterface