コード例 #1
0
 /**
  * Create and return the MVC controller plugin broker
  * 
  * @param  ServiceLocatorInterface $serviceLocator 
  * @return ControllerPluginBroker
  */
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $broker = new ControllerPluginBroker();
     $broker->setClassLoader($serviceLocator->get('ControllerPluginLoader'));
     $broker->setServiceLocator($serviceLocator);
     return $broker;
 }
コード例 #2
0
ファイル: ActionControllerTest.php プロジェクト: rikaix/zf2
 public function testInjectingBrokerSetsControllerWhenPossible()
 {
     $broker = new PluginBroker();
     $this->assertNull($broker->getController());
     $this->controller->setBroker($broker);
     $this->assertSame($this->controller, $broker->getController());
     $this->assertSame($broker, $this->controller->getBroker());
 }