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


PHP Registry\ServiceRegistryInterface类代码示例

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


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

示例1: Parameters

 function it_throws_an_exception_if_driver_is_not_supported(Grid $grid, ServiceRegistryInterface $driversRegistry)
 {
     $parameters = new Parameters();
     $grid->getDriver()->willReturn('doctrine/banana');
     $driversRegistry->has('doctrine/banana')->willReturn(false);
     $this->shouldThrow(new UnsupportedDriverException('doctrine/banana'))->during('getDataSource', [$grid, $parameters]);
 }
开发者ID:loic425,项目名称:Sylius,代码行数:7,代码来源:DataSourceProviderSpec.php

示例2:

 function it_renders_field_with_data_via_appriopriate_field_type(GridView $gridView, Field $field, ServiceRegistryInterface $fieldsRegistry, FieldTypeInterface $fieldType)
 {
     $field->getType()->willReturn('string');
     $fieldsRegistry->get('string')->willReturn($fieldType);
     $fieldType->render($field, 'Value')->willReturn('<strong>Value</strong>');
     $this->renderField($gridView, $field, 'Value')->shouldReturn('<strong>Value</strong>');
 }
开发者ID:ahmadrabie,项目名称:Sylius,代码行数:7,代码来源:TwigGridRendererSpec.php

示例3:

 function it_should_create_a_form_for_given_schema_namespace(FormInterface $form, FormBuilder $formBuilder, FormFactoryInterface $formFactory, SchemaInterface $schema, ServiceRegistryInterface $schemaRegistry)
 {
     $schemaRegistry->get('sylius_general')->willReturn($schema);
     $formFactory->createBuilder('form', null, ['data_class' => null])->willReturn($formBuilder);
     $schema->buildForm($formBuilder)->shouldBeCalled()->willReturn($formBuilder);
     $formBuilder->getForm()->willReturn($form);
     $this->create('sylius_general')->shouldReturn($form);
 }
开发者ID:loic425,项目名称:Sylius,代码行数:8,代码来源:SettingsFormFactorySpec.php

示例4:

 function it_builds_prototypes(FormBuilderInterface $builder, FormBuilderInterface $prototype, FormInterface $form, ServiceRegistryInterface $registry)
 {
     $registry->all()->willReturn(['configuration_kind' => '']);
     $builder->create('name', 'sylius_promotion_action', ['configuration_type' => 'configuration_kind'])->willReturn($prototype);
     $prototype->getForm()->willReturn($form);
     $builder->setAttribute('prototypes', ['configuration_kind' => $form])->shouldBeCalled();
     $this->buildForm($builder, ['registry' => $registry, 'prototype_name' => 'name', 'type' => 'sylius_promotion_action', 'options' => []]);
 }
开发者ID:loic425,项目名称:Sylius,代码行数:8,代码来源:PromotionActionCollectionTypeSpec.php

示例5:

 function it_should_delegate_calculation_to_a_calculator_defined_on_shipping_method(ServiceRegistryInterface $registry, ShipmentInterface $shipment, ShippingMethodInterface $method, CalculatorInterface $calculator)
 {
     $shipment->getMethod()->willReturn($method);
     $method->getCalculator()->willReturn('default');
     $method->getConfiguration()->willReturn([]);
     $registry->get('default')->willReturn($calculator);
     $calculator->calculate($shipment, [])->shouldBeCalled()->willReturn(1000);
     $this->calculate($shipment, [])->shouldReturn(1000);
 }
开发者ID:loic425,项目名称:Sylius,代码行数:9,代码来源:DelegatingCalculatorSpec.php

示例6:

 function it_registers_theme_schema_alias_if_not_exists_during_loading_settings(SettingsManagerInterface $decoratedSettingsManager, ServiceRegistryInterface $schemaRegistry, ThemeSettingsSchemaProviderInterface $themeSettingsSchemaProvider, ThemeInterface $theme, SettingsInterface $settings, SchemaInterface $schema)
 {
     $theme->getName()->willReturn('theme/name');
     $schemaRegistry->has('theme_theme/name')->willReturn(false);
     $themeSettingsSchemaProvider->getSchema($theme)->willReturn($schema);
     $schemaRegistry->register('theme_theme/name', $schema)->shouldBeCalled();
     $decoratedSettingsManager->load('theme_theme/name', null)->willReturn($settings);
     $this->load($theme)->shouldReturn($settings);
 }
开发者ID:ReissClothing,项目名称:Sylius,代码行数:9,代码来源:ThemeSettingsManagerSpec.php

示例7: create

 /**
  * {@inheritdoc}
  */
 public function create($schemaAlias, $data = null, array $options = [])
 {
     $schema = $this->schemaRegistry->get($schemaAlias);
     $builder = $this->formFactory->createBuilder('form', $data, array_merge_recursive(['data_class' => null], $options));
     $schema->buildForm($builder);
     return $builder->getForm();
 }
开发者ID:ahmadrabie,项目名称:Sylius,代码行数:10,代码来源:SettingsFormFactory.php

示例8: addConfigurationFields

 /**
  * @param FormInterface $form
  * @param string        $ruleType
  * @param array         $data
  */
 protected function addConfigurationFields(FormInterface $form, $ruleType, array $data = [])
 {
     /** @var RuleCheckerInterface $checker */
     $checker = $this->checkerRegistry->get($ruleType);
     $configurationField = $this->factory->createNamed('configuration', $checker->getConfigurationFormType(), $data, ['auto_initialize' => false]);
     $form->add($configurationField);
 }
开发者ID:TeamNovatek,项目名称:Sylius,代码行数:12,代码来源:BuildRuleFormSubscriber.php

示例9: get

 /**
  * {@inheritdoc}
  */
 public function get($type)
 {
     if (!$this->decoratedRegistry->has($type)) {
         return $this->defaultResolver;
     }
     return $this->decoratedRegistry->get($type);
 }
开发者ID:ReissClothing,项目名称:Sylius,代码行数:10,代码来源:ResolverServiceRegistry.php

示例10: buildForm

 /**
  * {@inheritdoc}
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->addEventSubscriber(new AddCodeFormSubscriber())->addEventSubscriber(new BuildReportDataFetcherFormSubscriber($this->dataFetcherRegistry, $builder->getFormFactory()))->addEventSubscriber(new BuildReportRendererFormSubscriber($this->rendererRegistry, $builder->getFormFactory()))->add('name', 'text', ['label' => 'sylius.form.report.name', 'required' => true])->add('description', 'textarea', ['label' => 'sylius.form.report.description', 'required' => false])->add('dataFetcher', 'sylius_data_fetcher_choice', ['label' => 'sylius.form.report.data_fetcher'])->add('renderer', 'sylius_renderer_choice', ['label' => 'sylius.form.report.renderer.label']);
     $prototypes = ['renderers' => [], 'dataFetchers' => []];
     foreach ($this->rendererRegistry->all() as $type => $renderer) {
         $formType = sprintf('sylius_renderer_%s', $renderer->getType());
         if (!$formType) {
             continue;
         }
         try {
             $prototypes['renderers'][$type] = $builder->create('rendererConfiguration', $formType)->getForm();
         } catch (\InvalidArgumentException $e) {
             continue;
         }
     }
     foreach ($this->dataFetcherRegistry->all() as $type => $dataFetcher) {
         $formType = sprintf('sylius_data_fetcher_%s', $dataFetcher->getType());
         if (!$formType) {
             continue;
         }
         try {
             $prototypes['dataFetchers'][$type] = $builder->create('dataFetcherConfiguration', $formType)->getForm();
         } catch (\InvalidArgumentException $e) {
             continue;
         }
     }
     $builder->setAttribute('prototypes', $prototypes);
 }
开发者ID:vikey89,项目名称:Sylius,代码行数:31,代码来源:ReportType.php

示例11: apply

 /**
  * {@inheritdoc}
  */
 public function apply(DataSourceInterface $dataSource, Grid $grid, Parameters $parameters)
 {
     if ($parameters->has(ResourceOwnerFilter::TYPE)) {
         $this->filtersRegistry->get(ResourceOwnerFilter::TYPE)->apply($dataSource, ResourceOwnerFilter::FIELD, $parameters->get(ResourceOwnerFilter::TYPE), []);
     }
     return $this->filtersApplicator->apply($dataSource, $grid, $parameters);
 }
开发者ID:liverbool,项目名称:dos-resource-bundle,代码行数:10,代码来源:FiltersApplicator.php

示例12: getDataSource

 /**
  * {@inheritdoc}
  */
 public function getDataSource(Grid $grid, Parameters $parameters)
 {
     $driver = $grid->getDriver();
     if (!$this->driversRegistry->has($driver)) {
         throw new UnsupportedDriverException($driver);
     }
     return $this->driversRegistry->get($driver)->getDataSource($grid->getDriverConfiguration(), $parameters);
 }
开发者ID:ahmadrabie,项目名称:Sylius,代码行数:11,代码来源:DataSourceProvider.php

示例13: validate

 /**
  * {@inheritdoc}
  */
 public function validate($value, Constraint $constraint)
 {
     if (!$value instanceof AttributeValueInterface) {
         throw new UnexpectedTypeException(get_class($value), AttributeValueInterface::class);
     }
     $attributeType = $this->attributeTypeRegistry->get($value->getType());
     $attributeType->validate($value, $this->context, $value->getAttribute()->getConfiguration());
 }
开发者ID:ahmadrabie,项目名称:Sylius,代码行数:11,代码来源:ValidAttributeValueValidator.php

示例14: renderField

 /**
  * @param Field $field
  * @param $data
  */
 public function renderField(GridView $gridView, Field $field, $data)
 {
     $fieldType = $this->fieldsRegistry->get($field->getType());
     $resolver = new OptionsResolver();
     $fieldType->configureOptions($resolver);
     $options = $resolver->resolve($field->getOptions());
     return $fieldType->render($field, $data, $options);
 }
开发者ID:okwinza,项目名称:Sylius,代码行数:12,代码来源:TwigGridRenderer.php

示例15: calculate

 /**
  * {@inheritdoc}
  */
 public function calculate(PriceableInterface $subject, array $context = array())
 {
     if (null === ($type = $subject->getPricingCalculator())) {
         throw new \InvalidArgumentException('Cannot calculate the price for PriceableInterface instance without calculator defined.');
     }
     $calculator = $this->registry->get($type);
     return $calculator->calculate($subject, $subject->getPricingConfiguration(), $context);
 }
开发者ID:aleherse,项目名称:Sylius,代码行数:11,代码来源:DelegatingCalculator.php


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