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


PHP ServiceRegistryInterface::get方法代码示例

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


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

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

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

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

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

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

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

示例7: render

 /**
  * {@inheritdoc}
  *
  * @throws \InvalidArgumentException If the report subject does not have a renderer.
  */
 public function render(ReportInterface $subject, Data $data)
 {
     if (null === ($type = $subject->getRenderer())) {
         throw new \InvalidArgumentException('Cannot render data for ReportInterface instance without renderer defined.');
     }
     $renderer = $this->registry->get($type);
     return $renderer->render($subject, $data);
 }
开发者ID:nanyi,项目名称:Sylius,代码行数:13,代码来源:DelegatingRenderer.php

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

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

示例10: calculate

 /**
  * {@inheritdoc}
  */
 public function calculate(ShippingSubjectInterface $subject)
 {
     if (null === ($method = $subject->getMethod())) {
         throw new UndefinedShippingMethodException('Cannot calculate charge for shipping subject without defined shipping method.');
     }
     $calculator = $this->registry->get($method->getCalculator());
     return $calculator->calculate($subject, $method->getConfiguration());
 }
开发者ID:aleherse,项目名称:Sylius,代码行数:11,代码来源:DelegatingCalculator.php

示例11: configureOptions

 /**
  * {@inheritdoc}
  */
 public function configureOptions(OptionsResolver $resolver)
 {
     $resolver->setDefaults(['resource' => null, 'choices' => function (Options $options) {
         return $options['function']($this->resourceRepositoryRegistry->get($options['resource']), $options);
     }, 'function' => function (RepositoryInterface $repository, Options $options) {
         return $repository->findAll();
     }])->setRequired(['resource']);
 }
开发者ID:NeverResponse,项目名称:Sylius,代码行数:11,代码来源:ResourceChoiceType.php

示例12: createTyped

 /**
  * {@inheritdoc}
  */
 public function createTyped($type)
 {
     /** @var AttributeTypeInterface $attributeType */
     $attributeType = $this->attributeTypesRegistry->get($type);
     $attribute = $this->factory->createNew();
     $attribute->setType($type);
     $attribute->setStorageType($attributeType->getStorageType());
     return $attribute;
 }
开发者ID:sylius,项目名称:attribute,代码行数:12,代码来源:AttributeFactory.php

示例13: buildForm

 /**
  * {@inheritdoc}
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     if (!$options['multiple']) {
         $builder->addModelTransformer(new ResourceToIdentifierTransformer($this->resourceRepositoryRegistry->get($options['resource']), $options['choice_value']));
     }
     if ($options['multiple']) {
         $builder->addModelTransformer(new RecursiveTransformer(new ResourceToIdentifierTransformer($this->resourceRepositoryRegistry->get($options['resource']), $options['choice_value'])))->addViewTransformer(new CollectionToStringTransformer(','));
     }
 }
开发者ID:NeverResponse,项目名称:Sylius,代码行数:12,代码来源:ResourceAutocompleteChoiceType.php

示例14: calculate

 /**
  * {@inheritdoc}
  */
 public function calculate(PaymentSubjectInterface $payment)
 {
     if (null === $payment->getMethod()) {
         throw new \InvalidArgumentException("Cannot calculate fee for payment without payment method configured.");
     }
     /** @var FeeCalculatorInterface $feeCalculator */
     $feeCalculator = $this->serviceRegistry->get($payment->getMethod()->getFeeCalculator());
     return $feeCalculator->calculate($payment, $payment->getMethod()->getFeeCalculatorConfiguration());
 }
开发者ID:nanyi,项目名称:Sylius,代码行数:12,代码来源:DelegatingFeeCalculator.php

示例15: fetch

 /**
  * {@inheritdoc}
  *
  * @throws \InvalidArgumentException If the report does not have a data fetcher.
  */
 public function fetch(ReportInterface $report, array $configuration = [])
 {
     if (null === ($type = $report->getDataFetcher())) {
         throw new \InvalidArgumentException('Cannot fetch data for ReportInterface instance without DataFetcher defined.');
     }
     $dataFetcher = $this->registry->get($type);
     $configuration = empty($configuration) ? $report->getDataFetcherConfiguration() : $configuration;
     return $dataFetcher->fetch($configuration);
 }
开发者ID:ahmadrabie,项目名称:Sylius,代码行数:14,代码来源:DelegatingDataFetcher.php


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