當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。