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


PHP Config\ConfigManager类代码示例

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


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

示例5: 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

示例6: 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

示例7: 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

示例8: 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

示例9: 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

示例10: 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

示例11: 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

示例12: 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

示例13: 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

示例14: 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

示例15: 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


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