本文整理匯總了PHP中Zend\Mvc\Controller\PluginManager::setController方法的典型用法代碼示例。如果您正苦於以下問題:PHP PluginManager::setController方法的具體用法?PHP PluginManager::setController怎麽用?PHP PluginManager::setController使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Zend\Mvc\Controller\PluginManager
的用法示例。
在下文中一共展示了PluginManager::setController方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testPluginManagerInjectsControllerForExistingPlugin
public function testPluginManagerInjectsControllerForExistingPlugin()
{
$controller1 = new SampleController();
$pluginManager = new PluginManager();
$pluginManager->setInvokableClass('samplePlugin', 'ZendTest\\Mvc\\Controller\\Plugin\\TestAsset\\SamplePlugin');
$pluginManager->setController($controller1);
// Plugin manager registers now instance of SamplePlugin
$pluginManager->get('samplePlugin');
$controller2 = new SampleController();
$pluginManager->setController($controller2);
$plugin = $pluginManager->get('samplePlugin');
$this->assertEquals($controller2, $plugin->getController());
}
示例2: setPluginManager
/**
* Set plugin manager
*
* @param PluginManager $plugins
* @return AbstractController
*/
public function setPluginManager(PluginManager $plugins)
{
$this->plugins = $plugins;
$this->plugins->setController($this);
return $this;
}
示例3: setPluginManager
/**
* Set plugin manager
*
* @param string|PluginManager $plugins
* @return AbstractController
* @throws Exception\InvalidArgumentException
*/
public function setPluginManager(PluginManager $plugins)
{
$this->plugins = $plugins;
if (method_exists($plugins, 'setController')) {
$this->plugins->setController($this);
}
return $this;
}