src/Money/Module/Category/Controller/Category.php
public function ajaxModal()
    {
        if (!Server::getInstance()->isAjax() || !Server::getInstance()->isPost()) {
            throw new \RuntimeException();
        }

        $params =  $this->route->getParameterCollection();
        $modal  = ucfirst($params->getByName('modal_type')->getValue());

        $categoryMapper = new CategoryMapper(Database::get('money'));

        if ($modal === 'Create') {
            $categoryId = 0;
            $accountId  = $params->getByName('id')->getValue();
            $category   = $categoryMapper->newDataInstance();
        } else {
            $categoryId = $params->getByName('id')->getValue();
            $category   = $categoryMapper->findById($categoryId);
            $accountId  = $category->getAccountId();
        }

        //~ Verify if account is for current user, else throw error 500
        $mapper      = new AccountUserMapper(Database::get('money'));
        $accountUser = $mapper->findByKeys(array('user_id' => Session::getInstance()->get('id'), 'account_id' => $accountId));
        $account     = $accountUser->getAccount();

        $categoryMapper = new CategoryMapper(Database::get('money'));
        $categories     = $categoryMapper->findAllByAccountId($accountId, $categoryId);

        $this->dataCollection->add('categories', $categories);
        $this->dataCollection->add('category',   $category);
        $this->dataCollection->add('account',    $account);

        return $this->getResponse('Modal/' . $modal, true);
    }
public function ajaxModal()
    {
        if (!Server::getInstance()->isAjax() || !Server::getInstance()->isPost()) {
            throw new \RuntimeException();
        }

        $params =  $this->route->getParameterCollection();
        $modal  = ucfirst($params->getByName('modal_type')->getValue());

        $categoryMapper = new CategoryMapper(Database::get('money'));

        if ($modal === 'Create') {
            $categoryId = 0;
            $accountId  = $params->getByName('id')->getValue();
            $category   = $categoryMapper->newDataInstance();
        } else {
            $categoryId = $params->getByName('id')->getValue();
            $category   = $categoryMapper->findById($categoryId);
            $accountId  = $category->getAccountId();
        }

        //~ Verify if account is for current user, else throw error 500
        $mapper      = new AccountUserMapper(Database::get('money'));
        $accountUser = $mapper->findByKeys(array('user_id' => Session::getInstance()->get('id'), 'account_id' => $accountId));
        $account     = $accountUser->getAccount();

        $categoryMapper = new CategoryMapper(Database::get('money'));
        $categories     = $categoryMapper->findAllByAccountId($accountId, $categoryId);

        $this->dataCollection->add('categories', $categories);
        $this->dataCollection->add('category',   $category);
        $this->dataCollection->add('account',    $account);

        return $this->getResponse('Modal/' . $modal, true);
    }
Return html code for category modal edit / create

@return ResponseInterface