Skip to content
This repository has been archived by the owner on May 9, 2019. It is now read-only.

Creating Controllers

xaav edited this page Oct 2, 2011 · 1 revision

When creating controllers, make sure your controllers extend HelioPanelAbstractController, so that you will get additional functions associated with extending that class.

For example, consider the following controller:

<?php

namespace YourVendor\YourBundle\Controller;

use HelioNetworks\HelioPanelBundle\Controller\HelioPanelAbstractController;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;

class YourController extends HelioPanelAbstractController
{
	/**
	 * @Route("/your/route", name="your_route")
	 * @Template()
	 */
	public function yourAction()
	{
		return array();
	}
}

This is the "default" controller that you should use in your bundle. It contains several useful methods:

  • getUser(): Get the currently logged in user.
  • installHook(Account $account): Reinstall the hook.
  • getActiveAccount(): Get the currently selected account.
  • setActiveAccount(Account $account): Set the currently selected account.
  • getHook(): Get the currently selected account's hook.
Clone this wiki locally