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


PHP Pimple::extend方法代码示例

本文整理汇总了PHP中Pimple::extend方法的典型用法代码示例。如果您正苦于以下问题:PHP Pimple::extend方法的具体用法?PHP Pimple::extend怎么用?PHP Pimple::extend使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Pimple的用法示例。


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

示例1: register

 public function register(\Pimple $container)
 {
     $container['doctrine'] = $container->share(function ($container) {
         return new ManagerRegistry($container);
     });
     if (isset($container['form.extensions']) && class_exists('Symfony\\Bridge\\Doctrine\\Form\\DoctrineOrmExtension')) {
         $container['form.extensions'] = $container->share($container->extend('form.extensions', function ($extensions, $container) {
             $extensions[] = new DoctrineOrmExtension($container['doctrine']);
             return $extensions;
         }));
     }
     if (isset($container['validator']) && class_exists('Symfony\\Bridge\\Doctrine\\Validator\\Constraints\\UniqueEntityValidator')) {
         $container['doctrine.orm.validator.unique_validator'] = $container->share(function ($container) {
             return new UniqueEntityValidator($container['doctrine']);
         });
         if (!isset($container['validator.validator_service_ids'])) {
             $container['validator.validator_service_ids'] = array();
         }
         $container['validator.validator_service_ids'] = array_merge($container['validator.validator_service_ids'], array('doctrine.orm.validator.unique' => 'doctrine.orm.validator.unique_validator'));
         $container['validator.object_initializers'] = $container->share($container->extend('validator.object_initializers', function (array $objectInitializers) use($container) {
             $objectInitializers[] = new DoctrineInitializer($container['doctrine']);
             return $objectInitializers;
         }));
     }
     if (class_exists('Saxulum\\DoctrineOrmCommands\\Command\\CreateDatabaseDoctrineCommand')) {
         if (isset($container['console'])) {
             $container['console'] = $container->share($container->extend('console', function (ConsoleApplication $consoleApplication) use($container) {
                 $helperSet = $consoleApplication->getHelperSet();
                 $helperSet->set(new ManagerRegistryHelper($container['doctrine']), 'doctrine');
                 return $consoleApplication;
             }));
         }
         if (isset($container['console.commands'])) {
             $container['console.commands'] = $container->share($container->extend('console.commands', function ($commands) use($container) {
                 $commands[] = new CreateDatabaseDoctrineCommand();
                 $commands[] = new DropDatabaseDoctrineCommand();
                 $commands[] = new CreateSchemaDoctrineCommand();
                 $commands[] = new UpdateSchemaDoctrineCommand();
                 $commands[] = new DropSchemaDoctrineCommand();
                 $commands[] = new RunDqlDoctrineCommand();
                 $commands[] = new RunSqlDoctrineCommand();
                 $commands[] = new ConvertMappingDoctrineCommand();
                 $commands[] = new ClearMetadataCacheDoctrineCommand();
                 $commands[] = new ClearQueryCacheDoctrineCommand();
                 $commands[] = new ClearResultCacheDoctrineCommand();
                 $commands[] = new InfoDoctrineCommand();
                 $commands[] = new ValidateSchemaCommand();
                 $commands[] = new EnsureProductionSettingsDoctrineCommand();
                 return $commands;
             }));
         }
     }
 }
开发者ID:ygeneration666,项目名称:ec,代码行数:53,代码来源:DoctrineOrmManagerRegistryProvider.php

示例2: registerFilters

 public static function registerFilters(\Pimple $container)
 {
     $container['inspector.filter_listener'] = $container->share($container->extend('inspector.filter_listener', function ($listener, $c) {
         $listener->addAvailableFilter('gitignore', function () {
             return new Filter\GitIgnoreFilter();
         });
         return $listener;
     }));
 }
开发者ID:wouterj,项目名称:inspector,代码行数:9,代码来源:InspectorServiceProvider.php

示例3: process

 public function process(Definition $serviceConf, array $tags, \Pimple $container)
 {
     foreach ($tags as $tag) {
         if (strtolower($tag['name']) === 'konfigurator.event_listener') {
             $container[$this->dispatcher] = $container->extend($this->dispatcher, function ($dispatcher, $c) use($serviceConf, $tag) {
                 $dispatcher->addListener($tag['event'], function () use($serviceConf, $tag, $c) {
                     $service = $serviceConf->getName();
                     $method = $tag['method'];
                     if (isset($c[$service])) {
                         return call_user_func_array(array($c[$service], $method), func_get_args());
                     }
                     return false;
                 });
                 return $dispatcher;
             });
         }
     }
 }
开发者ID:td7650,项目名称:yml2pimple,代码行数:18,代码来源:EventListenerTagHandler.php

示例4: extend

 /**
  * {@inheritdoc}
  */
 public function extend($id, $callable)
 {
     return $this->container->extend($id, $callable);
 }
开发者ID:johndotcat,项目名称:bolt,代码行数:7,代码来源:ContainerProxy.php


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