• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Config\ConfigManager类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: setUp

 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     $this->record = $this->getMock('Oro\\Bundle\\DataGridBundle\\Datasource\\ResultRecordInterface');
     $this->configManager = $this->getMockBuilder('Oro\\Bundle\\ConfigBundle\\Config\\ConfigManager')->disableOriginalConstructor()->getMock();
     $this->configManager->expects($this->any())->method('get')->with('oro_b2b_rfp.default_request_status')->will($this->returnValue(self::CONFIG_DEFAULT_STATUS));
     $this->actionPermissionProvider = new ActionPermissionProvider($this->configManager);
 }
开发者ID:hafeez3000,项目名称:orocommerce,代码行数:10,代码来源:ActionPermissionProviderTest.php


示例2: preSubmit

 /**
  * Preset default values if default checkbox set
  *
  * @param FormEvent $event
  */
 public function preSubmit(FormEvent $event)
 {
     $data = $event->getData();
     foreach ($data as $key => $val) {
         if (!empty($val['use_parent_scope_value'])) {
             $data[$key]['value'] = $this->configManager->get(str_replace(ConfigManager::SECTION_VIEW_SEPARATOR, ConfigManager::SECTION_MODEL_SEPARATOR, $key), true);
         }
     }
     $event->setData($data);
 }
开发者ID:Maksold,项目名称:platform,代码行数:15,代码来源:ConfigSubscriber.php


示例3: configureCredentials

 /**
  * Configure credentials
  *
  * @param ConfigManager $configManager
  */
 public function configureCredentials(ConfigManager $configManager)
 {
     $clientIdKey = 'oro_google_integration.client_id';
     if ($clientId = $configManager->get($clientIdKey)) {
         $this->options['client_id'] = $clientId;
     }
     $clientSecretKey = 'oro_google_integration.client_secret';
     if ($clientSecret = $configManager->get($clientSecretKey)) {
         $this->options['client_secret'] = $clientSecret;
     }
 }
开发者ID:ramunasd,项目名称:platform,代码行数:16,代码来源:ConfigurableCredentialsTrait.php


示例4: configureCredentials

 /**
  * Configure credentials
  *
  * @param ConfigManager $configManager
  */
 public function configureCredentials(ConfigManager $configManager)
 {
     $clientIdKey = sprintf('oro_sso.%s_sso_client_id', $this->getName());
     if ($clientId = $configManager->get($clientIdKey)) {
         $this->options['client_id'] = $clientId;
     }
     $clientSecretKey = sprintf('oro_sso.%s_sso_client_secret', $this->getName());
     if ($clientSecret = $configManager->get($clientSecretKey)) {
         $this->options['client_secret'] = $clientSecret;
     }
 }
开发者ID:Maksold,项目名称:platform,代码行数:16,代码来源:ConfigurableCredentialsTrait.php


示例5: trans

 /**
  * Checks if the given template contains several parts and if so translate each part individually
  *
  * @param string $titleTemplate
  * @param array  $params
  *
  * @return string
  */
 public function trans($titleTemplate, array $params = [])
 {
     if (!$titleTemplate) {
         return $titleTemplate;
     }
     $delimiter = ' ' . $this->userConfigManager->get('oro_navigation.title_delimiter') . ' ';
     $transItems = explode($delimiter, $titleTemplate);
     foreach ($transItems as $key => $transItem) {
         $transItems[$key] = $this->translator->trans($transItem, $params);
     }
     return implode($delimiter, $transItems);
 }
开发者ID:Maksold,项目名称:platform,代码行数:20,代码来源:TitleTranslator.php


示例6: setUp

 protected function setUp()
 {
     $this->logger = $this->getMock('Psr\\Log\\LoggerInterface');
     $this->entityManager = $this->getMockBuilder('Doctrine\\ORM\\EntityManager')->disableOriginalConstructor()->getMock();
     $this->entityPool = $this->getMockBuilder('Oro\\Bundle\\NotificationBundle\\Doctrine\\EntityPool')->disableOriginalConstructor()->getMock();
     $this->emailRenderer = $this->getMockBuilder('Oro\\Bundle\\EmailBundle\\Provider\\EmailRenderer')->disableOriginalConstructor()->getMock();
     $this->mailer = $this->getMockBuilder('Swift_Mailer')->disableOriginalConstructor()->getMock();
     $this->cm = $this->getMockBuilder('Oro\\Bundle\\ConfigBundle\\Config\\ConfigManager')->disableOriginalConstructor()->getMock();
     $this->cm->expects($this->any())->method('get')->will($this->returnValueMap([['oro_notification.email_notification_sender_email', false, false, self::TEST_SENDER_EMAIL], ['oro_notification.email_notification_sender_name', false, false, self::TEST_SENDER_NAME]]));
     $this->processor = new EmailNotificationProcessor($this->logger, $this->entityManager, $this->entityPool, $this->emailRenderer, $this->mailer, $this->cm);
     $this->processor->setEnv(self::TEST_ENV);
     $this->processor->setMessageLimit(self::TEST_MESSAGE_LIMIT);
 }
开发者ID:Maksold,项目名称:platform,代码行数:13,代码来源:EmailNotificationProcessorTest.php


示例7: validate

 /**
  * @param string          $dataClass Parent entity class name
  * @param File|Attachment $entity    File entity
  * @param string          $fieldName Field name where new file/image field was added
  *
  * @return \Symfony\Component\Validator\ConstraintViolationListInterface
  */
 public function validate($dataClass, $entity, $fieldName = '')
 {
     /** @var Config $entityAttachmentConfig */
     if ($fieldName === '') {
         $entityAttachmentConfig = $this->attachmentConfigProvider->getConfig($dataClass);
         $mimeTypes = $this->getMimeArray($entityAttachmentConfig->get('mimetypes'));
         if (!$mimeTypes) {
             $mimeTypes = array_merge($this->getMimeArray($this->config->get('oro_attachment.upload_file_mime_types')), $this->getMimeArray($this->config->get('oro_attachment.upload_image_mime_types')));
         }
     } else {
         $entityAttachmentConfig = $this->attachmentConfigProvider->getConfig($dataClass, $fieldName);
         /** @var FieldConfigId $fieldConfigId */
         $fieldConfigId = $entityAttachmentConfig->getId();
         if ($fieldConfigId->getFieldType() === 'file') {
             $configValue = 'upload_file_mime_types';
         } else {
             $configValue = 'upload_image_mime_types';
         }
         $mimeTypes = $this->getMimeArray($this->config->get('oro_attachment.' . $configValue));
     }
     $fileSize = $entityAttachmentConfig->get('maxsize') * 1024 * 1024;
     foreach ($mimeTypes as $id => $value) {
         $mimeTypes[$id] = trim($value);
     }
     return $this->validator->validate($entity->getFile(), [new FileConstraint(['maxSize' => $fileSize, 'mimeTypes' => $mimeTypes])]);
 }
开发者ID:ramunasd,项目名称:platform,代码行数:33,代码来源:ConfigFileValidator.php


示例8: process

 /**
  * Applies the given notifications to the given object
  *
  * @param mixed                        $object
  * @param EmailNotificationInterface[] $notifications
  * @param LoggerInterface              $logger Override for default logger. If this parameter is specified
  *                                             this logger will be used instead of a logger specified
  *                                             in the constructor
  */
 public function process($object, $notifications, LoggerInterface $logger = null)
 {
     if (!$logger) {
         $logger = $this->logger;
     }
     foreach ($notifications as $notification) {
         $emailTemplate = $notification->getTemplate();
         try {
             list($subjectRendered, $templateRendered) = $this->renderer->compileMessage($emailTemplate, ['entity' => $object]);
         } catch (\Twig_Error $e) {
             $identity = method_exists($emailTemplate, '__toString') ? (string) $emailTemplate : $emailTemplate->getSubject();
             $logger->error(sprintf('Rendering of email template "%s" failed. %s', $identity, $e->getMessage()), ['exception' => $e]);
             continue;
         }
         $senderEmail = $this->cm->get('oro_notification.email_notification_sender_email');
         $senderName = $this->cm->get('oro_notification.email_notification_sender_name');
         if ($notification instanceof SenderAwareEmailNotificationInterface && $notification->getSenderEmail()) {
             $senderEmail = $notification->getSenderEmail();
             $senderName = $notification->getSenderName();
         }
         if ($emailTemplate->getType() == 'txt') {
             $type = 'text/plain';
         } else {
             $type = 'text/html';
         }
         foreach ((array) $notification->getRecipientEmails() as $email) {
             $message = \Swift_Message::newInstance()->setSubject($subjectRendered)->setFrom($senderEmail, $senderName)->setTo($email)->setBody($templateRendered, $type);
             $this->mailer->send($message);
         }
         $this->addJob(self::SEND_COMMAND);
     }
 }
开发者ID:Maksold,项目名称:platform,代码行数:41,代码来源:EmailNotificationProcessor.php


示例9: testChecksVisibilityFromConfig

 /**
  * @dataProvider visibilityDataProvider
  * @param string $visibility
  * @param bool $expected
  */
 public function testChecksVisibilityFromConfig($visibility, $expected)
 {
     $this->configManager->expects($this->once())->method('get')->with('orob2b_product.default_visibility')->willReturn($visibility);
     $product = $this->getProductMock();
     $product->expects($this->once())->method('getVisibility')->willReturn(Product::VISIBILITY_BY_CONFIG);
     $this->assertEquals($expected, $this->service->isVisible($product));
 }
开发者ID:hafeez3000,项目名称:orocommerce,代码行数:12,代码来源:VisibilityCheckerTest.php


示例10: process

 /**
  * Applies the given notifications to the given object
  *
  * @param mixed                        $object
  * @param EmailNotificationInterface[] $notifications
  * @param LoggerInterface              $logger Override for default logger. If this parameter is specified
  *                                             this logger will be used instead of a logger specified
  *                                             in the constructor
  */
 public function process($object, $notifications, LoggerInterface $logger = null)
 {
     if (!$logger) {
         $logger = $this->logger;
     }
     foreach ($notifications as $notification) {
         /** @var EmailTemplate $emailTemplate */
         $emailTemplate = $notification->getTemplate();
         try {
             list($subjectRendered, $templateRendered) = $this->renderer->compileMessage($emailTemplate, array('entity' => $object));
         } catch (\Twig_Error $e) {
             $logger->error(sprintf('Rendering of email template "%s"%s failed. %s', $emailTemplate->getSubject(), method_exists($emailTemplate, 'getId') ? sprintf(' (id: %d)', $emailTemplate->getId()) : '', $e->getMessage()), array('exception' => $e));
             continue;
         }
         $senderEmail = $this->cm->get('oro_notification.email_notification_sender_email');
         $senderName = $this->cm->get('oro_notification.email_notification_sender_name');
         $type = $emailTemplate->getType() == 'txt' ? 'text/plain' : 'text/html';
         $recipients = $notification->getRecipientEmails();
         foreach ((array) $recipients as $email) {
             $message = \Swift_Message::newInstance()->setSubject($subjectRendered)->setFrom($senderEmail, $senderName)->setTo($email)->setBody($templateRendered, $type);
             $this->mailer->send($message);
         }
         $this->addJob(self::SEND_COMMAND);
     }
 }
开发者ID:xamin123,项目名称:platform,代码行数:34,代码来源:EmailNotificationProcessor.php


示例11: getConfigValue

 /**
  * @param string $name
  * @return array|string
  */
 protected function getConfigValue($name)
 {
     if (!$this->configManager) {
         $this->configManager = $this->container->get('oro_config.manager');
     }
     return $this->configManager->get($name);
 }
开发者ID:adam-paterson,项目名称:orocommerce,代码行数:11,代码来源:AccountUserManager.php


示例12: setDefaultOptions

 /**
  * {@inheritdoc}
  */
 public function setDefaultOptions(OptionsResolverInterface $resolver)
 {
     $defaultWysiwygOptions = ['plugins' => ['textcolor', 'code', 'link', 'bdesk_photo'], 'toolbar_type' => self::TOOLBAR_DEFAULT, 'skin_url' => 'bundles/oroform/css/tinymce', 'valid_elements' => implode(',', $this->htmlTagProvider->getAllowedElements()), 'menubar' => false, 'statusbar' => false, 'relative_urls' => false, 'remove_script_host' => false, 'convert_urls' => true];
     $defaults = ['wysiwyg_enabled' => (bool) $this->configManager->get('oro_form.wysiwyg_enabled'), 'wysiwyg_options' => $defaultWysiwygOptions, 'page-component' => ['module' => 'oroui/js/app/components/view-component', 'options' => ['view' => 'oroform/js/app/views/wysiwig-editor/wysiwyg-editor-view', 'content_css' => 'bundles/oroform/css/wysiwyg-editor.css']]];
     $resolver->setDefaults($defaults);
     $resolver->setNormalizers(['wysiwyg_options' => function (Options $options, $wysiwygOptions) use($defaultWysiwygOptions) {
         if (empty($wysiwygOptions['toolbar_type']) || !array_key_exists($wysiwygOptions['toolbar_type'], $this->toolbars)) {
             $toolbarType = self::TOOLBAR_DEFAULT;
         } else {
             $toolbarType = $wysiwygOptions['toolbar_type'];
         }
         $wysiwygOptions['toolbar'] = $this->toolbars[$toolbarType];
         $wysiwygOptions = array_merge($defaultWysiwygOptions, $wysiwygOptions);
         unset($wysiwygOptions['toolbar_type']);
         return $wysiwygOptions;
     }, 'attr' => function (Options $options, $attr) {
         $pageComponent = $options->get('page-component');
         $wysiwygOptions = (array) $options->get('wysiwyg_options');
         if ($this->assetHelper) {
             if (!empty($pageComponent['options']['content_css'])) {
                 $pageComponent['options']['content_css'] = $this->assetHelper->getUrl($pageComponent['options']['content_css']);
             }
             if (!empty($wysiwygOptions['skin_url'])) {
                 $wysiwygOptions['skin_url'] = $this->assetHelper->getUrl($wysiwygOptions['skin_url']);
             }
         }
         $pageComponent['options'] = array_merge($pageComponent['options'], $wysiwygOptions);
         $pageComponent['options']['enabled'] = (bool) $options->get('wysiwyg_enabled');
         $attr['data-page-component-module'] = $pageComponent['module'];
         $attr['data-page-component-options'] = json_encode($pageComponent['options']);
         return $attr;
     }]);
 }
开发者ID:nmallare,项目名称:platform,代码行数:36,代码来源:OroRichTextType.php


示例13: isFresh

 /**
  * Check whenever given language package up to date
  *
  * @param string $languageCode
  *
  * @return bool
  */
 public function isFresh($languageCode)
 {
     if (!isset($this->processedLanguages[$languageCode])) {
         $configData = $this->cm->get(TranslationStatusInterface::META_CONFIG_KEY);
         $stats = $this->statisticProvider->get();
         if (isset($configData[$languageCode])) {
             $stats = array_filter($stats, function ($langInfo) use($languageCode) {
                 return $langInfo['code'] === $languageCode;
             });
             $lang = array_pop($stats);
             if ($lang) {
                 $installationDate = $this->getDateTimeFromString($configData[$languageCode]['lastBuildDate']);
                 $currentBuildDate = $this->getDateTimeFromString($lang['lastBuildDate']);
                 $this->processedLanguages[$languageCode] = $installationDate >= $currentBuildDate;
             } else {
                 // could not retrieve current language stats, so assume that it's fresh
                 $this->processedLanguages[$languageCode] = true;
             }
         } else {
             // if we do not have information about installed time then assume that needs update
             $this->processedLanguages[$languageCode] = false;
         }
     }
     return $this->processedLanguages[$languageCode];
 }
开发者ID:Maksold,项目名称:platform,代码行数:32,代码来源:TranslationStatusExtension.php


示例14: postAction

 /**
  * Set the current configuration
  *
  * @AclAncestor("oro_config_system")
  *
  * @return JsonResponse
  */
 public function postAction(Request $request)
 {
     $this->configManager->save(json_decode($request->getContent(), true));
     $data = json_decode($request->getContent(), true);
     file_put_contents($this->getMessagesFilePath(), $data['pim_ui___loading_messages']['value']);
     return $this->getAction();
 }
开发者ID:a2xchip,项目名称:pim-community-dev,代码行数:14,代码来源:ConfigurationController.php


示例15: setDefaultOptions

 /**
  * {@inheritdoc}
  */
 public function setDefaultOptions(OptionsResolverInterface $resolver)
 {
     $isWysiwygEnabled = $this->configManager->get('oro_form.wysiwyg_enabled');
     $resolver->setDefaults(['translatable_class' => 'Oro\\Bundle\\EmailBundle\\Entity\\EmailTemplate', 'intention' => 'emailtemplate_translation', 'extra_fields_message' => 'This form should not contain extra fields: "{{ extra_fields }}"', 'cascade_validation' => true, 'labels' => [], 'content_options' => [], 'subject_options' => [], 'fields' => function (Options $options) use($isWysiwygEnabled) {
         return ['subject' => array_merge(['field_type' => 'text'], $options->get('subject_options')), 'content' => array_merge(['field_type' => 'oro_rich_text', 'attr' => ['class' => 'template-editor', 'data-wysiwyg-enabled' => $isWysiwygEnabled], 'wysiwyg_options' => ['height' => '250px']], $options->get('content_options'))];
     }]);
 }
开发者ID:Maksold,项目名称:platform,代码行数:10,代码来源:EmailTemplateTranslationType.php


示例16: isDefaultBranch

 public function isDefaultBranch(Branch $branch)
 {
     $defaultBranchId = $this->manager->get('diamante_email_processing.default_branch');
     if (empty($defaultBranchId)) {
         return false;
     }
     return (int) $defaultBranchId === $branch->getId();
 }
开发者ID:gitter-badger,项目名称:diamantedesk-application,代码行数:8,代码来源:BranchExtension.php


示例17: buildForm

 /**
  * {@inheritdoc}
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->add('name', 'text', ['label' => 'orob2b.rfp.requeststatus.name.label', 'required' => true])->add('sortOrder', 'integer', ['label' => 'orob2b.rfp.requeststatus.sort_order.label', 'required' => true]);
     $lang = $this->localeSettings->getLanguage();
     $notificationLangs = $this->userConfig->get('oro_locale.languages');
     $notificationLangs = array_unique(array_merge($notificationLangs, [$lang]));
     $localeLabels = $this->localeSettings->getLocalesByCodes($notificationLangs, $lang);
     $builder->add('translations', 'orob2b_rfp_request_status_translation', ['label' => 'orob2b.rfp.requeststatus.label.label', 'required' => false, 'locales' => $notificationLangs, 'labels' => $localeLabels]);
 }
开发者ID:hafeez3000,项目名称:orocommerce,代码行数:12,代码来源:RequestStatusType.php


示例18: sendEmail

 /**
  * @param UserInterface $user
  * @param array         $templateData
  * @param string        $type
  *
  * @return int          The return value is the number of recipients who were accepted for delivery
  */
 protected function sendEmail(UserInterface $user, array $templateData, $type)
 {
     list($subjectRendered, $templateRendered) = $templateData;
     $senderEmail = $this->configManager->get('oro_notification.email_notification_sender_email');
     $senderName = $this->configManager->get('oro_notification.email_notification_sender_name');
     $email = $this->emailHolderHelper->getEmail($user);
     $message = \Swift_Message::newInstance()->setSubject($subjectRendered)->setFrom($senderEmail, $senderName)->setTo($email)->setBody($templateRendered, $type);
     return $this->mailer->send($message);
 }
开发者ID:Maksold,项目名称:platform,代码行数:16,代码来源:BaseProcessor.php


示例19: addApplicationUrl

 /**
  * @param array $result
  * @param bool  $addValue
  */
 protected function addApplicationUrl(array &$result, $addValue)
 {
     if ($addValue) {
         $val = $this->configManager->get('oro_ui.application_url');
     } else {
         $val = ['type' => 'string', 'label' => $this->translator->trans('oro.email.emailtemplate.app_url')];
     }
     $result['appURL'] = $val;
 }
开发者ID:Maksold,项目名称:platform,代码行数:13,代码来源:SystemVariablesProvider.php


示例20: build

 /**
  * Modify menu by adding, removing or editing items.
  *
  * @param \Knp\Menu\ItemInterface $menu
  * @param array                   $options
  * @param string|null             $alias
  */
 public function build(ItemInterface $menu, array $options = array(), $alias = null)
 {
     $options['orderBy'] = array(array('field' => NavigationHistoryItem::NAVIGATION_HISTORY_COLUMN_VISIT_COUNT));
     $maxItems = $this->configOptions->get('oro_navigation.maxItems');
     if (!is_null($maxItems)) {
         $options['maxItems'] = $maxItems;
     }
     parent::build($menu, $options, $alias);
 }
开发者ID:ramunasd,项目名称:platform,代码行数:16,代码来源:NavigationMostviewedBuilder.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Common\DatagridConfiguration类代码示例发布时间:2022-05-23
下一篇:
PHP vfs\vfsStreamWrapper类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap