Last active
December 31, 2015 00:29
-
-
Save jmorgan74/7907762 to your computer and use it in GitHub Desktop.
Controller Abstraction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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