Skip to content

Instantly share code, notes, and snippets.

@jmorgan74
Last active December 31, 2015 00:29
Show Gist options
  • Save jmorgan74/7907762 to your computer and use it in GitHub Desktop.
Save jmorgan74/7907762 to your computer and use it in GitHub Desktop.
Controller Abstraction
abstract class BaseController {
/**
* @var Creator
*/
protected $creator;
/**
* @var Destroyer
*/
protected $destroyer;
public function createAction()
{
$this->creator->create();
}
public function destroyAction()
{
$this->destroyer->destroy();
}
}
class FundController extends BaseController
{
public function __construct()
{
$this->creator = $this->get('fund.creator');
$this->destroyer = $this->get('fund.destroyer');
}
}
parameters:
fund.creator.class: Morgz/Bundle/UserManagerBundle/Creator/FundCreator
fund.destroyer.class: Morgz/Bundle/UserManagerBundle/Creator/FundDestroyer
services:
fund.creator:
class: %fund.creator.class%
fund.destroyer:
class: %fund.destroyer.class%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment