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


PHP ServiceRegistryInterface::all方法代码示例

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


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

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

示例2: buildForm

 /**
  * {@inheritdoc}
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $prototypes = [];
     foreach (array_keys($this->registry->all()) as $type) {
         $prototypeOptions = array_replace(['configuration_type' => $type], $options['options']);
         $form = $builder->create($options['prototype_name'], $options['type'], $prototypeOptions);
         $prototypes[$type] = $form->getForm();
     }
     $builder->setAttribute('prototypes', $prototypes);
 }
开发者ID:ReissClothing,项目名称:Sylius,代码行数:13,代码来源:AbstractConfigurationCollectionType.php

示例3: setBuilderFeeCalculatorsConfigurationsAttribute

 /**
  * @param FormBuilderInterface $builder
  */
 private function setBuilderFeeCalculatorsConfigurationsAttribute(FormBuilderInterface $builder)
 {
     $feeCalculatorsConfigurations = array();
     foreach ($this->feeCalculatorRegistry->all() as $type => $feeCalculator) {
         $formType = sprintf('sylius_fee_calculator_%s', $feeCalculator->getType());
         try {
             $feeCalculatorsConfigurations[$type] = $builder->create('feeCalculatorConfiguration', $formType)->getForm();
         } catch (\InvalidArgumentException $exception) {
             continue;
         }
     }
     $builder->setAttribute('feeCalculatorsConfigurations', $feeCalculatorsConfigurations);
 }
开发者ID:nanyi,项目名称:Sylius,代码行数:16,代码来源:PaymentMethodType.php

示例4: buildForm

 /**
  * {@inheritdoc}
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->add('name', 'text', array('label' => 'sylius.form.promotion.name'))->add('description', 'text', array('label' => 'sylius.form.promotion.description'))->add('exclusive', 'checkbox', array('label' => 'sylius.form.promotion.exclusive'))->add('usageLimit', 'integer', array('label' => 'sylius.form.promotion.usage_limit'))->add('startsAt', 'date', array('label' => 'sylius.form.promotion.starts_at', 'empty_value' => array('year' => '-', 'month' => '-', 'day' => '-')))->add('endsAt', 'date', array('label' => 'sylius.form.promotion.ends_at', 'empty_value' => array('year' => '-', 'month' => '-', 'day' => '-')))->add('couponBased', 'checkbox', array('label' => 'sylius.form.promotion.coupon_based', 'required' => false))->add('rules', 'collection', array('type' => 'sylius_promotion_rule', 'allow_add' => true, 'by_reference' => false, 'label' => 'sylius.form.promotion.rules'))->add('actions', 'collection', array('type' => 'sylius_promotion_action', 'allow_add' => true, 'by_reference' => false, 'label' => 'sylius.form.promotion.actions'));
     $prototypes = array();
     $prototypes['rules'] = array();
     foreach ($this->checkerRegistry->all() as $type => $checker) {
         $prototypes['rules'][$type] = $builder->create('__name__', $checker->getConfigurationFormType())->getForm();
     }
     $prototypes['actions'] = array();
     foreach ($this->actionRegistry->all() as $type => $action) {
         $prototypes['actions'][$type] = $builder->create('__name__', $action->getConfigurationFormType())->getForm();
     }
     $builder->setAttribute('prototypes', $prototypes);
 }
开发者ID:bcremer,项目名称:Sylius,代码行数:17,代码来源:PromotionType.php

示例5:

 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

示例6: buildForm

 /**
  * {@inheritdoc}
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->addEventSubscriber($this->formSubscriber)->add('pricingCalculator', 'sylius_price_calculator_choice', ['label' => 'sylius.form.priceable.calculator']);
     $prototypes = [];
     /** @var CalculatorInterface $calculator */
     foreach ($this->calculatorRegistry->all() as $type => $calculator) {
         $formType = sprintf('sylius_price_calculator_%s', $calculator->getType());
         if (!$formType) {
             continue;
         }
         try {
             $prototypes[$type] = $builder->create('pricingConfiguration', $formType)->getForm();
         } catch (\InvalidArgumentException $e) {
             continue;
         }
     }
     $builder->setAttribute('prototypes', $prototypes);
 }
开发者ID:ahmadrabie,项目名称:Sylius,代码行数:21,代码来源:PriceableTypeExtension.php

示例7: buildForm

 /**
  * {@inheritdoc}
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->addEventSubscriber(new BuildShippingMethodFormSubscriber($this->calculatorRegistry, $builder->getFormFactory(), $this->formRegistry))->addEventSubscriber(new AddCodeFormSubscriber())->add('translations', 'sylius_translations', ['type' => 'sylius_shipping_method_translation', 'label' => 'sylius.form.shipping_method.translations'])->add('category', 'sylius_shipping_category_choice', ['required' => false, 'empty_value' => 'sylius.ui.no_requirement', 'label' => 'sylius.form.shipping_method.category'])->add('categoryRequirement', 'choice', ['choices' => ShippingMethod::getCategoryRequirementLabels(), 'multiple' => false, 'expanded' => true, 'label' => 'sylius.form.shipping_method.category_requirement'])->add('calculator', 'sylius_shipping_calculator_choice', ['label' => 'sylius.form.shipping_method.calculator'])->add('enabled', 'checkbox', ['label' => 'sylius.form.locale.enabled']);
     $prototypes = ['rules' => [], 'calculators' => []];
     /** @var RuleCheckerInterface $checker */
     foreach ($this->checkerRegistry->all() as $type => $checker) {
         $prototypes['rules'][$type] = $builder->create('__name__', $checker->getConfigurationFormType())->getForm();
     }
     /** @var CalculatorInterface $calculator */
     foreach ($this->calculatorRegistry->all() as $name => $calculator) {
         $calculatorTypeName = sprintf('sylius_shipping_calculator_%s', $calculator->getType());
         if (!$this->formRegistry->hasType($calculatorTypeName)) {
             continue;
         }
         $prototypes['calculators'][$name] = $builder->create('configuration', $calculatorTypeName)->getForm();
     }
     $builder->setAttribute('prototypes', $prototypes);
 }
开发者ID:TheMadeleine,项目名称:Sylius,代码行数:21,代码来源:ShippingMethodType.php

示例8: buildForm

 /**
  * {@inheritdoc}
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->addEventSubscriber(new BuildShippingMethodFormSubscriber($this->calculatorRegistry, $builder->getFormFactory(), $this->formRegistry))->addEventSubscriber(new AddCodeFormSubscriber())->add('translations', 'a2lix_translationsForms', array('form_type' => 'sylius_shipping_method_translation', 'label' => 'sylius.form.shipping_method.name'))->add('category', 'sylius_shipping_category_choice', array('required' => false, 'label' => 'sylius.form.shipping_method.category'))->add('categoryRequirement', 'choice', array('choices' => ShippingMethod::getCategoryRequirementLabels(), 'multiple' => false, 'expanded' => true, 'label' => 'sylius.form.shipping_method.category_requirement'))->add('calculator', 'sylius_shipping_calculator_choice', array('label' => 'sylius.form.shipping_method.calculator'));
     $prototypes = array();
     $prototypes['rules'] = array();
     foreach ($this->checkerRegistry->all() as $type => $checker) {
         $prototypes['rules'][$type] = $builder->create('__name__', $checker->getConfigurationFormType())->getForm();
     }
     $prototypes['calculators'] = array();
     foreach ($this->calculatorRegistry->all() as $name => $calculator) {
         $calculatorTypeName = sprintf("sylius_shipping_calculator_%s", $calculator->getType());
         if (!$this->formRegistry->hasType($calculatorTypeName)) {
             continue;
         }
         $prototypes['calculators'][$name] = $builder->create('configuration', $calculatorTypeName)->getForm();
     }
     $builder->setAttribute('prototypes', $prototypes);
 }
开发者ID:aleherse,项目名称:Sylius,代码行数:21,代码来源:ShippingMethodType.php

示例9: buildForm

 /**
  * {@inheritdoc}
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->addEventSubscriber(new BuildPriceableFormListener($this->calculatorRegistry, $builder->getFormFactory()))->add('pricingCalculator', 'sylius_price_calculator_choice', array('label' => 'sylius.form.priceable.calculator'));
     $prototypes = array();
     $prototypes['calculators'] = array();
     foreach ($this->calculatorRegistry->all() as $type => $calculator) {
         $formType = sprintf('sylius_price_calculator_%s', $calculator->getType());
         if (!$formType) {
             continue;
         }
         try {
             $prototypes['calculators'][$type] = $builder->create('configuration', $formType)->getForm();
         } catch (\InvalidArgumentException $e) {
             continue;
         }
     }
     $builder->setAttribute('prototypes', $prototypes);
 }
开发者ID:bcremer,项目名称:Sylius,代码行数:21,代码来源:PriceableTypeExtension.php

示例10: buildForm

 /**
  * {@inheritdoc}
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->addEventSubscriber($this->buildShippingMethodFormSubscriber)->addEventSubscriber(new AddCodeFormSubscriber())->add('translations', ResourceTranslationsType::class, ['entry_type' => $this->shippingMethodTranslationType, 'label' => 'sylius.form.shipping_method.translations'])->add('position', IntegerType::class, ['required' => false, 'label' => 'sylius.form.shipping_method.position'])->add('category', ShippingCategoryChoiceType::class, ['required' => false, 'placeholder' => 'sylius.ui.no_requirement', 'label' => 'sylius.form.shipping_method.category'])->add('categoryRequirement', ChoiceType::class, ['choices' => array_flip(ShippingMethod::getCategoryRequirementLabels()), 'multiple' => false, 'expanded' => true, 'label' => 'sylius.form.shipping_method.category_requirement'])->add('calculator', CalculatorChoiceType::class, ['label' => 'sylius.form.shipping_method.calculator'])->add('enabled', CheckboxType::class, ['label' => 'sylius.form.locale.enabled']);
     $prototypes = ['rules' => [], 'calculators' => []];
     /** @var RuleCheckerInterface $checker */
     foreach ($this->checkerRegistry->all() as $type => $checker) {
         $prototypes['rules'][$type] = $builder->create('__name__', $checker->getConfigurationFormType())->getForm();
     }
     /** @var CalculatorInterface $calculator */
     foreach ($this->calculatorRegistry->all() as $name => $calculator) {
         $calculatorType = $calculator->getType();
         if (!$this->formTypeRegistry->has($calculatorType, 'default')) {
             continue;
         }
         $form = $builder->create('configuration', $this->formTypeRegistry->get($calculatorType, 'default'));
         $prototypes['calculators'][$name] = $form->getForm();
     }
     $builder->setAttribute('prototypes', $prototypes);
 }
开发者ID:sylius,项目名称:sylius,代码行数:22,代码来源:ShippingMethodType.php

示例11:

 function it_builds_form(ServiceRegistryInterface $calculatorRegistry, EventSubscriberInterface $subscriber, FormBuilderInterface $builder, CalculatorInterface $calculator, FormBuilderInterface $formBuilder, FormInterface $form)
 {
     $builder->addEventSubscriber($subscriber)->shouldBeCalled()->willreturn($builder);
     $builder->add('pricingCalculator', 'sylius_price_calculator_choice', Argument::type('array'))->shouldBeCalled();
     $calculatorRegistry->all()->shouldBeCalled()->willReturn(['type' => $calculator]);
     $calculator->getType()->shouldBeCalled()->willReturn('standard');
     $builder->create('pricingConfiguration', 'sylius_price_calculator_standard')->shouldBeCalled()->willReturn($formBuilder);
     $formBuilder->getForm()->shouldBeCalled()->willReturn($form);
     $builder->setAttribute('prototypes', ['type' => $form])->shouldBeCalled();
     $this->buildForm($builder, []);
 }
开发者ID:loic425,项目名称:Sylius,代码行数:11,代码来源:PriceableTypeExtensionSpec.php

示例12:

 function it_builds_prototypes_forms_for_calculators(ServiceRegistryInterface $calculatorRegistry, FormBuilder $builder, FormBuilder $flatRateFormBuilder, Form $flatRateForm, CalculatorInterface $flatRateCalculator, FormBuilder $perUnitFormBuilder, Form $perUnitForm, CalculatorInterface $perUnitRateCalculator, FormRegistryInterface $formRegistry)
 {
     $builder->add(Argument::any(), Argument::cetera())->willReturn($builder);
     $builder->addEventSubscriber(Argument::any())->willReturn($builder);
     $flatRateCalculator->getType()->willReturn('flat_rate');
     $perUnitRateCalculator->getType()->willReturn('per_unit_rate');
     $calculatorRegistry->all()->willReturn(['flat_rate' => $flatRateCalculator, 'per_unit_rate' => $perUnitRateCalculator]);
     $flatRateFormBuilder->getForm()->willReturn($flatRateForm);
     $builder->create('configuration', 'sylius_shipping_calculator_flat_rate')->willReturn($flatRateFormBuilder);
     $perUnitFormBuilder->getForm()->willReturn($perUnitForm);
     $builder->create('configuration', 'sylius_shipping_calculator_per_unit_rate')->willReturn($perUnitFormBuilder);
     $formRegistry->hasType('sylius_shipping_calculator_per_unit_rate')->shouldBeCalled()->willReturn(true);
     $formRegistry->hasType('sylius_shipping_calculator_flat_rate')->shouldBeCalled()->willReturn(true);
     $builder->setAttribute('prototypes', ['calculators' => ['flat_rate' => $flatRateForm, 'per_unit_rate' => $perUnitForm], 'rules' => []])->shouldBeCalled();
     $this->buildForm($builder, []);
 }
开发者ID:loic425,项目名称:Sylius,代码行数:16,代码来源:ShippingMethodTypeSpec.php

示例13: all

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


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