<?php

namespace Akhann\StaticPageBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;

abstract class DefaultController extends Controller
{
    abstract public function getIndexTemplate();
    abstract public function getShowTemplateNamespace();

    public function indexAction()
    {
        return $this->render($this->getIndexTemplate());
    }

    public function showAction($pageId)
    {
        $template = $this->getShowTemplate($pageId);
        $templating = $this->get('templating');

        if (!$templating->exists($template))
        {
            throw $this->createNotFoundException(sprintf('Page not found. Create template %s', $template));
        }

        return $this->render($template);
    }

    public function subShowAction($parentPageId, $pageId)
    {
        $template = $this->getShowTemplate($parentPageId, $pageId);
        $templating = $this->get('templating');

        if (!$templating->exists($template))
        {
            throw $this->createNotFoundException(sprintf('Page not found. Create template %s', $template));
        }

        return $this->render($template);
    }

    protected function getShowTemplate($parentPageId, $pageId=null)
    {
        if (is_null($pageId)) {
            $pageId = $parentPageId;
        }

        $pageId = sprintf('%s_%s', $parentPageId, $pageId);

        return sprintf('%s:%s.html.twig', $this->getShowTemplateNamespace(), $pageId);
    }

}

<?php

namespace Akhann\StaticPageBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;

abstract class DefaultController extends Controller
{
    abstract public function getIndexTemplate();
    abstract public function getShowTemplateNamespace();

    public function indexAction()
    {
        return $this->render($this->getIndexTemplate());
    }

    public function showAction($pageId)
    {
        $template = $this->getShowTemplate($pageId);
        $templating = $this->get('templating');

        if (!$templating->exists($template))
        {
            throw $this->createNotFoundException(sprintf('Page not found. Create template %s', $template));
        }

        return $this->render($template);
    }

    public function subShowAction($parentPageId, $pageId)
    {
        $template = $this->getShowTemplate($parentPageId, $pageId);
        $templating = $this->get('templating');

        if (!$templating->exists($template))
        {
            throw $this->createNotFoundException(sprintf('Page not found. Create template %s', $template));
        }

        return $this->render($template);
    }

    protected function getShowTemplate($parentPageId, $pageId=null)
    {
        if (is_null($pageId)) {
            $pageId = $parentPageId;
        }
        else {
            $pageId = sprintf('%s_%s', $parentPageId, $pageId);
        }

        return sprintf('%s:%s.html.twig', $this->getShowTemplateNamespace(), $pageId);
    }

}

Fix bug wrong pageId in showAction
Fix bug wrong pageId in showAction
