netgusto/hmvc-bundle

Stupid simple HMVC service for Symfony 2

dev-master 2014-06-01 11:43 UTC

This package is not auto-updated.

Last update: 2024-11-19 07:30:25 UTC


README

Install

In composer.json:

"require": {
    "netgusto/hmvc-bundle": "dev-master"
}

In app/AppKernel.php:

$bundles = array(
    # [...]
    new Netgusto\HMVCBundle\NetgustoHMVCBundle(),
    # [...]
);

Use

namespace Acme\DemoBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller,
    Symfony\Component\HttpFoundation\Request;

class DefaultController extends Controller {

    public function someAction(Request $request) {
        
        $newsletterResponse = $this->get('netgusto.hmvc')->delegate('AcmeDemoBundle:SomeOtherController:subscribeNewsletter');

        return $this->render('AcmeDemoBundle:Default:home.html.twig', array(
            'newsletter' => $newsletterResponse->getContent(),
        ));
    }
}