当前位置: 首页>>代码示例>>PHP>>正文


PHP Controller\PluginManager类代码示例

本文整理汇总了PHP中Zend\Mvc\Controller\PluginManager的典型用法代码示例。如果您正苦于以下问题:PHP PluginManager类的具体用法?PHP PluginManager怎么用?PHP PluginManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了PluginManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setUp

    public function setUp()
    {
        $plugins  = new ControllerPluginManager();
        $selector = $plugins->get('AcceptableViewModelSelector');

        $this->listener   = new AcceptListener($selector, array(
            'controllers' => array(
                'ZFTest\ContentNegotiation\TestAsset\ContentTypeController' => 'Json',
            ),
            'selectors' => array(
                'Json' => array(
                    'Zend\View\Model\JsonModel' => array(
                        'application/json',
                        'application/*+json',
                    ),
                ),
            ),
        ));
        $this->event      = new MvcEvent();
        $this->controller = new TestAsset\ContentTypeController();
        $this->event->setTarget($this->controller);
        $this->event->setRequest(new Request);
        $this->event->setRouteMatch(new RouteMatch(array(
            'controller' => __NAMESPACE__ . '\TestAsset\ContentTypeController',
        )));

        $this->controller->setEvent($this->event);
        $this->controller->setRequest($this->event->getRequest());
        $this->controller->setPluginManager($plugins);
    }
开发者ID:jbarentsen,项目名称:drb,代码行数:30,代码来源:AcceptListenerTest.php

示例2: testGetWithConstrutorAndOptions

 public function testGetWithConstrutorAndOptions()
 {
     $pluginManager = new PluginManager();
     $pluginManager->setInvokableClass('samplePlugin', 'ZendTest\\Mvc\\Controller\\Plugin\\TestAsset\\SamplePluginWithConstructor');
     $plugin = $pluginManager->get('samplePlugin', 'foo');
     $this->assertEquals($plugin->getBar(), 'foo');
 }
开发者ID:rodriquelca,项目名称:zf2,代码行数:7,代码来源:PluginManagerTest.php

示例3: __invoke

 /**
  * {@inheritdoc}
  *
  * @param PluginManager $pluginManager
  *
  * @return InitMetaTags
  */
 public function __invoke(PluginManager $pluginManager)
 {
     /* @var \Zend\ServiceManager\ServiceManager */
     $viewHelper = $pluginManager->getController()->getServiceLocator()->get('ViewHelperManager');
     /*
      * @var \Zend\View\Helper\Placeholder\Container
      */
     $placeholderContainer = $viewHelper->get('placeholder')->getContainer('customHead');
     /*
      * @var \Zend\View\Helper\HeadMeta
      */
     $headMeta = $viewHelper->get('HeadMeta');
     /*
      * @var \Zend\Http\PhpEnvironment\Request
      */
     $request = $pluginManager->getController()->getRequest();
     /*
      * @var \SD\Application\Controller\Plugin\SystemSettings
      */
     $systemSettings = $pluginManager->get('systemsettings');
     /*
      * @var InitMetaTags
      */
     $plugin = new InitMetaTags($placeholderContainer, $headMeta, $request, $systemSettings);
     return $plugin;
 }
开发者ID:samsonasik,项目名称:unnamed,代码行数:33,代码来源:InitMetaTagsFactory.php

示例4: __invoke

 /**
  * {@inheritdoc}
  *
  * @param PluginManager $pluginManager
  *
  * @return Translate
  */
 public function __invoke(PluginManager $pluginManager)
 {
     /* @var \Zend\ServiceManager\ServiceManager */
     $translator = $pluginManager->getController()->getServiceLocator()->get('translator')->getTranslator();
     $plugin = new Translate($translator);
     return $plugin;
 }
开发者ID:samsonasik,项目名称:unnamed,代码行数:14,代码来源:TranslateFactory.php

示例5: __invoke

 /**
  * {@inheritdoc}
  */
 public function __invoke(PluginManager $pluginManager)
 {
     /* @var Zend\ServiceManager\ServiceManager */
     $serviceLocator = $pluginManager->getController()->getServiceLocator();
     $plugin = new GetTableModel($serviceLocator);
     return $plugin;
 }
开发者ID:samsonasik,项目名称:unnamed,代码行数:10,代码来源:GetTableModelFactory.php

示例6: url

 /**
  * Retourne le plugin url.
  *
  * @var \Zend\Mvc\Controller\PluginManager
  */
 public function url()
 {
     if (!$this->_url) {
         $this->_url = $this->_pluginManager->get('url');
     }
     return $this->_url;
 }
开发者ID:antarus,项目名称:mystra-pve,代码行数:12,代码来源:EvenementsTemplateRolesGrid.php

示例7: setUp

 public function setUp()
 {
     $this->controller = $controller = new RestController();
     $this->router = $router = new SimpleRouteStack();
     $route = new Segment('/resource[/[:id]]');
     $router->addRoute('resource', $route);
     $this->event = $event = new MvcEvent();
     $event->setRouter($router);
     $event->setRouteMatch(new RouteMatch(array()));
     $controller->setEvent($event);
     $controller->setRoute('resource');
     $pluginManager = new PluginManager();
     $pluginManager->setService('bodyParams', new BodyParams());
     $controller->setPluginManager($pluginManager);
     $urlHelper = new UrlHelper();
     $urlHelper->setRouter($this->router);
     $serverUrlHelper = new ServerUrlHelper();
     $serverUrlHelper->setScheme('http');
     $serverUrlHelper->setHost('localhost.localdomain');
     $linksHelper = new HalHelper();
     $linksHelper->setUrlHelper($urlHelper);
     $linksHelper->setServerUrlHelper($serverUrlHelper);
     $pluginManager->setService('Hal', $linksHelper);
     $linksHelper->setController($controller);
     $this->resource = $resource = new Resource();
     $controller->setResource($resource);
 }
开发者ID:noc-med,项目名称:zf-rest,代码行数:27,代码来源:RestControllerTest.php

示例8: setupHelpers

    public function setupHelpers()
    {
        if (!$this->router) {
            $this->setupRouter();
        }

        $urlHelper = new UrlHelper();
        $urlHelper->setRouter($this->router);

        $serverUrlHelper = new ServerUrlHelper();
        $serverUrlHelper->setScheme('http');
        $serverUrlHelper->setHost('localhost.localdomain');

        $linksHelper = new HalHelper();
        $linksHelper->setUrlHelper($urlHelper);
        $linksHelper->setServerUrlHelper($serverUrlHelper);

        $this->helpers = $helpers = new HelperPluginManager();
        $helpers->setService('url', $urlHelper);
        $helpers->setService('serverUrl', $serverUrlHelper);
        $helpers->setService('hal', $linksHelper);

        $this->plugins = $plugins = new ControllerPluginManager();
        $plugins->setService('hal', $linksHelper);
    }
开发者ID:jbarentsen,项目名称:drb,代码行数:25,代码来源:ChildEntitiesIntegrationTest.php

示例9: __invoke

 /**
  * {@inheritdoc}
  */
 public function __invoke(PluginManager $pluginManager)
 {
     $controller = $pluginManager->getController();
     $layout = $controller->layout();
     $response = $controller->getResponse();
     $plugin = new ErrorCodes($layout, $response);
     return $plugin;
 }
开发者ID:samsonasik,项目名称:unnamed,代码行数:11,代码来源:ErrorCodesFactory.php

示例10: testCreateService

 public function testCreateService()
 {
     $pm = new ControllerPluginManager();
     $sm = new ServiceManager();
     $sm->setService('AcMailer\\Service\\MailService', new MailServiceMock());
     $pm->setServiceLocator($sm);
     $this->assertInstanceOf('AcMailer\\Controller\\Plugin\\SendMailPlugin', $this->factory->createService($pm));
 }
开发者ID:quangdungninh,项目名称:zendvnteam,代码行数:8,代码来源:SendMailPluginFactoryTest.php

示例11: testCanCreateByFactoryWithConstrutor

 public function testCanCreateByFactoryWithConstrutor()
 {
     $pluginManager = new PluginManager();
     $pluginManager->setFactory('samplePlugin', 'ZendTest\\Mvc\\Controller\\Plugin\\TestAsset\\SamplePluginWithConstructorFactory');
     $plugin = $pluginManager->get('samplePlugin', 'foo');
     $this->assertInstanceOf('\\ZendTest\\Mvc\\Controller\\Plugin\\TestAsset\\SamplePluginWithConstructor', $plugin);
     $this->assertEquals($plugin->getBar(), 'foo');
 }
开发者ID:nieldm,项目名称:zf2,代码行数:8,代码来源:PluginManagerTest.php

示例12: createControllerManager

 protected function createControllerManager($config = [])
 {
     $pm = new ControllerPluginManager();
     $sm = new ServiceManager();
     $sm->setService('Config', $config);
     $pm->setServiceLocator($sm);
     return $pm;
 }
开发者ID:wasabiNorman,项目名称:ZF2-AcMailer,代码行数:8,代码来源:SendMailPluginAbstractFactoryTest.php

示例13: setUp

 /**
  * {@inheritDoc}
  */
 public function setUp()
 {
     $this->serviceManager = Bootstrap::getServiceManager();
     $this->entityManager = $this->serviceManager->get('doctrine.entitymanager.orm_default');
     $this->createMergedDocument = new CreateMergedDocument();
     $pluginManager = new PluginManager();
     $pluginManager->setServiceLocator($this->serviceManager);
     $this->createMergedDocument->setServiceLocator($pluginManager);
 }
开发者ID:debranova,项目名称:project,代码行数:12,代码来源:CreateMergeDocumentTest.php

示例14: setupMockFlashMessenger

 private function setupMockFlashMessenger($messageType)
 {
     $flashMessenger = $this->getMock('Zend\\Mvc\\Controller\\Plugin\\FlashMessenger');
     $flashMessenger->expects($this->any())->method('has' . $messageType . 'Messages')->will($this->returnValue(true));
     $flashMessenger->expects($this->any())->method('get' . $messageType . 'Messages')->will($this->returnValue($this->testMessages));
     $plugins = new PluginManager();
     $plugins->setService('FlashMessenger', $flashMessenger);
     $this->controller->setPluginManager($plugins);
 }
开发者ID:netsensia,项目名称:zf2-foundation,代码行数:9,代码来源:NetsensiaActionControllerTest.php

示例15: __invoke

 /**
  * {@inheritdoc}
  *
  * @param PluginManager $pluginManager
  *
  * @return GetUrlParams
  */
 public function __invoke(PluginManager $pluginManager)
 {
     /*
      * @var \Zend\Mvc\Controller\Plugin\Params
      */
     $params = $pluginManager->get('params');
     $plugin = new GetUrlParams($params);
     return $plugin;
 }
开发者ID:samsonasik,项目名称:unnamed,代码行数:16,代码来源:GetUrlParamsFactory.php


注:本文中的Zend\Mvc\Controller\PluginManager类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。