本文整理汇总了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;
}