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


PHP Definition::setArguments方法代码示例

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


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

示例1: createDefinition

 /**
  * {@inheritdoc}
  */
 public function createDefinition(ContainerBuilder $container, array $config)
 {
     $definition = new Definition('Jose\\Object\\JWK');
     $definition->setFactory([new Reference('jose.factory.jwk'), 'createFromKeySet']);
     $definition->setArguments([new Reference($config['key_set']), $config['index']]);
     return $definition;
 }
开发者ID:spomky-labs,项目名称:jose-bundle,代码行数:10,代码来源:JWKSet.php

示例2: createDefinition

 /**
  * {@inheritdoc}
  */
 public function createDefinition(ContainerBuilder $container, array $config)
 {
     $definition = new Definition('Jose\\Object\\JWK');
     $definition->setFactory([new Reference('jose.factory.jwk'), 'createFromKeyFile']);
     $definition->setArguments([$config['path'], $config['password'], $config['additional_values']]);
     return $definition;
 }
开发者ID:spomky-labs,项目名称:jose-bundle,代码行数:10,代码来源:KeyFile.php

示例3: autowireConstructor

 /**
  * @param string $class
  * @param Definition $definition
  * @param string[] $classes
  * @param string $id
  * @param ContainerBuilder $container
  */
 private function autowireConstructor($class, Definition $definition, array $classes, $id, ContainerBuilder $container)
 {
     $reflection = new ReflectionClass($class);
     $constructor = $reflection->getConstructor();
     // service not created by factory with public constructor with not fully configured arguments
     if ($constructor !== NULL && $constructor->isPublic() && $definition->getFactoryMethod() === NULL) {
         $autowiredArgs = $this->autowireMethod($constructor, $definition->getArguments(), $classes, $id, $container);
         if ($definition instanceof DefinitionDecorator && $definition->getParent() !== NULL) {
             $parentDef = $container->getDefinition($definition->getParent());
             $parentDefArgsCount = count($parentDef->getArguments());
             $argsToReplace = array();
             foreach ($autowiredArgs as $i => $arg) {
                 if ($i < $parentDefArgsCount) {
                     $argsToReplace[$i] = $arg;
                     unset($autowiredArgs[$i]);
                 }
             }
             $definition->setArguments($autowiredArgs);
             foreach ($argsToReplace as $i => $arg) {
                 $definition->replaceArgument($i, $arg);
             }
         } else {
             $definition->setArguments($autowiredArgs);
         }
     }
 }
开发者ID:janmarek,项目名称:autowiring-bundle,代码行数:33,代码来源:AutowiringPass.php

示例4: array

 function it_processes_the_configuration_and_registers_services_per_subject(ContainerBuilder $container)
 {
     $container->hasParameter('sylius.translation.mapping')->willReturn(false);
     $container->hasParameter('sylius.translation.default.mapping')->willReturn(true);
     $container->getParameter('sylius.translation.default.mapping')->willReturn(array(array('default_mapping' => array('translatable' => array('field' => 'translations', 'currentLocale' => 'currentLocale', 'fallbackLocale' => 'fallbackLocale'), 'translation' => array('field' => 'translatable', 'locale' => 'locale')))));
     $attributeFormType = new Definition('Some\\App\\Product\\Form\\AttributeType');
     $attributeFormType->setArguments(array('Some\\App\\Product\\Entity\\Attribute', '%sylius.validation_group.product_attribute%', 'product'));
     $attributeFormType->addTag('form.type', array('alias' => 'sylius_product_attribute'));
     $container->setDefinition('sylius.form.type.product_attribute', $attributeFormType)->shouldBeCalled();
     $attributeTranslationFormType = new Definition('Some\\App\\Product\\Form\\AttributeTranslationType');
     $attributeTranslationFormType->setArguments(array('Some\\App\\Product\\Entity\\AttributeTranslation', '%sylius.validation_group.product_attribute_translation%', 'product'));
     $attributeTranslationFormType->addTag('form.type', array('alias' => 'sylius_product_attribute_translation'));
     $container->setDefinition('sylius.form.type.product_attribute_translation', $attributeTranslationFormType)->shouldBeCalled();
     $choiceTypeClasses = array(SyliusResourceBundle::DRIVER_DOCTRINE_ORM => 'Sylius\\Bundle\\AttributeBundle\\Form\\Type\\AttributeEntityChoiceType');
     $attributeChoiceFormType = new Definition($choiceTypeClasses[SyliusResourceBundle::DRIVER_DOCTRINE_ORM]);
     $attributeChoiceFormType->setArguments(array('product', 'Some\\App\\Product\\Entity\\Attribute'));
     $attributeChoiceFormType->addTag('form.type', array('alias' => 'sylius_product_attribute_choice'));
     $container->setDefinition('sylius.form.type.product_attribute_choice', $attributeChoiceFormType)->shouldBeCalled();
     $attributeValueFormType = new Definition('Some\\App\\Product\\Form\\AttributeValueType');
     $attributeValueFormType->setArguments(array('Some\\App\\Product\\Entity\\AttributeValue', '%sylius.validation_group.product_attribute_value%', 'product'));
     $attributeValueFormType->addTag('form.type', array('alias' => 'sylius_product_attribute_value'));
     $container->setDefinition('sylius.form.type.product_attribute_value', $attributeValueFormType)->shouldBeCalled();
     $subjects = array('product' => array('subject' => 'Some\\App\\Product\\Entity\\Product', 'attribute' => array('model' => 'Some\\App\\Product\\Entity\\Attribute', 'form' => 'Some\\App\\Product\\Form\\AttributeType', 'translation' => array('model' => 'Some\\App\\Product\\Entity\\AttributeTranslation', 'form' => array('default' => 'Some\\App\\Product\\Form\\AttributeTranslationType'))), 'attribute_value' => array('model' => 'Some\\App\\Product\\Entity\\AttributeValue', 'form' => 'Some\\App\\Product\\Form\\AttributeValueType')));
     $container->setParameter('sylius.attribute.subjects', $subjects)->shouldBeCalled();
     $userConfig = array('driver' => SyliusResourceBundle::DRIVER_DOCTRINE_ORM, 'classes' => array('product' => array('subject' => 'Some\\App\\Product\\Entity\\Product', 'attribute' => array('model' => 'Some\\App\\Product\\Entity\\Attribute', 'form' => 'Some\\App\\Product\\Form\\AttributeType', 'translation' => array('model' => 'Some\\App\\Product\\Entity\\AttributeTranslation', 'form' => array('default' => 'Some\\App\\Product\\Form\\AttributeTranslationType'))), 'attribute_value' => array('model' => 'Some\\App\\Product\\Entity\\AttributeValue', 'form' => 'Some\\App\\Product\\Form\\AttributeValueType'))));
     $processedConfig = array('driver' => SyliusResourceBundle::DRIVER_DOCTRINE_ORM, 'classes' => array('product_attribute' => array('model' => 'Some\\App\\Product\\Entity\\Attribute', 'form' => 'Some\\App\\Product\\Form\\AttributeType', 'translation' => array('model' => 'Some\\App\\Product\\Entity\\AttributeTranslation', 'form' => array('default' => 'Some\\App\\Product\\Form\\AttributeTranslationType'))), 'product_attribute_value' => array('model' => 'Some\\App\\Product\\Entity\\AttributeValue', 'form' => 'Some\\App\\Product\\Form\\AttributeValueType')), 'validation_groups' => array('product_attribute' => array('sylius'), 'product_attribute_translation' => array('sylius'), 'product_attribute_value' => array('sylius')));
     $this->process($userConfig, $container)->shouldReturn($processedConfig);
 }
开发者ID:Strontium-90,项目名称:Sylius,代码行数:28,代码来源:SyliusAttributeExtensionSpec.php

示例5: load

 /**
  * {@inheritdoc}
  */
 public function load(array $config, ContainerBuilder $container)
 {
     $config = $this->processConfiguration(new Configuration(), $config);
     $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load(sprintf('driver/%s.xml', $config['driver']));
     $this->registerResources('sylius', $config['driver'], $config['resources'], $container);
     $configFiles = ['services.xml'];
     foreach ($configFiles as $configFile) {
         $loader->load($configFile);
     }
     $factoryDefinition = new Definition(Factory::class);
     $factoryDefinition->setArguments([new Parameter('sylius.model.taxonomy.class')]);
     $translatableFactoryDefinition = $container->getDefinition('sylius.factory.taxonomy');
     $taxonomyFactoryClass = $translatableFactoryDefinition->getClass();
     $translatableFactoryDefinition->setClass(TranslatableFactory::class);
     $translatableFactoryDefinition->setArguments([$factoryDefinition, new Reference('sylius.translation.locale_provider')]);
     $decoratedTaxonomyFactoryDefinition = new Definition($taxonomyFactoryClass);
     $decoratedTaxonomyFactoryDefinition->setArguments([$translatableFactoryDefinition, new Reference('sylius.factory.taxon')]);
     $container->setDefinition('sylius.factory.taxonomy', $decoratedTaxonomyFactoryDefinition);
     $taxonFactoryDefinition = $container->getDefinition('sylius.factory.taxon');
     $taxonFactoryClass = $taxonFactoryDefinition->getClass();
     $taxonFactoryDefinition->setClass(TranslatableFactory::class);
     $decoratedTaxonFactoryDefinition = new Definition($taxonFactoryClass);
     $decoratedTaxonFactoryDefinition->addArgument($taxonFactoryDefinition)->addArgument(new Reference('sylius.repository.taxonomy'));
     $container->setDefinition('sylius.factory.taxon', $decoratedTaxonFactoryDefinition);
 }
开发者ID:vikey89,项目名称:Sylius,代码行数:29,代码来源:SyliusTaxonomyExtension.php

示例6: loadConfigs

 /**
  * Process the adaptor config configuration.
  *
  * @param array $config
  * @param ContainerBuilder $container
  */
 protected function loadConfigs(array $config, ContainerBuilder $container)
 {
     foreach ($config['configs'] as $name => $arguments) {
         if (!$arguments['enabled']) {
             continue;
         }
         $id = 'integrated_channel.config.memory.' . $name;
         if ($container->hasDefinition($id)) {
             continue;
         }
         // first create the options and for that we need a unique service id
         do {
             $id_options = $id . '.options.' . uniqid();
         } while ($container->hasDefinition($id_options));
         $definition = new Definition('%integrated_channel.config.options.class%');
         $definition->setPublic(false);
         $definition->setArguments([$arguments['options']]);
         $container->setDefinition($id_options, $definition);
         // create the config it self
         $definition = new Definition('%integrated_channel.config.class%');
         $definition->setArguments([$name, $arguments['adaptor'], new Reference($id_options)]);
         if ($arguments['channel']) {
             foreach ($arguments['channel'] as $channel) {
                 $definition->addTag('integrated_channel.config', ['channel' => $channel]);
             }
         } else {
             $definition->addTag('integrated_channel.config');
         }
         $container->setDefinition($id, $definition);
     }
 }
开发者ID:integratedfordevelopers,项目名称:integrated-channel-bundle,代码行数:37,代码来源:IntegratedChannelExtension.php

示例7: createDefinition

 /**
  * {@inheritdoc}
  */
 public function createDefinition(ContainerBuilder $container, array $config)
 {
     $definition = new Definition('Jose\\Object\\X5UJWKSet');
     $definition->setFactory([new Reference('jose.factory.jwk'), 'createFromX5U']);
     $definition->setArguments([$config['url'], $config['is_secured'], $config['cache'], $config['cache_ttl'], $config['is_https']]);
     return $definition;
 }
开发者ID:spomky-labs,项目名称:jose-bundle,代码行数:10,代码来源:X5U.php

示例8: createDefinition

 /**
  * {@inheritdoc}
  */
 public function createDefinition(ContainerBuilder $container, array $config)
 {
     $definition = new Definition('Jose\\Object\\JWK');
     $definition->setFactory([new Reference('jose.factory.jwk'), 'createFromCertificate']);
     $definition->setArguments([$config['value']]);
     return $definition;
 }
开发者ID:spomky-labs,项目名称:jose-bundle,代码行数:10,代码来源:X5C.php

示例9: testProcessWithAddTemplates

 public function testProcessWithAddTemplates()
 {
     $container = $this->getContainer();
     $layoutLoaderDef = new Definition(TwigLayoutLoader::class);
     $mailLoaderDef = new Definition(TwigLayoutLoader::class);
     $layoutLoaderDef->setArguments(array(array()));
     $mailLoaderDef->setArguments(array(array()));
     $container->setDefinition('sonatra_mailer.loader.layout_twig', $layoutLoaderDef);
     $container->setDefinition('sonatra_mailer.loader.mail_twig', $mailLoaderDef);
     $this->assertCount(0, $layoutLoaderDef->getArgument(0));
     $this->assertCount(0, $mailLoaderDef->getArgument(0));
     // array loader
     $layoutArrayLoaderDef = new Definition(ArrayLayoutLoader::class);
     $mailArrayLoaderDef = new Definition(ArrayLayoutLoader::class);
     $layoutArrayLoaderDef->setArguments(array(array()));
     $mailArrayLoaderDef->setArguments(array(array()));
     $container->setDefinition('sonatra_mailer.loader.layout_array', $layoutArrayLoaderDef);
     $container->setDefinition('sonatra_mailer.loader.mail_array', $mailArrayLoaderDef);
     $this->assertCount(0, $layoutArrayLoaderDef->getArgument(0));
     $this->assertCount(0, $mailArrayLoaderDef->getArgument(0));
     // add mocks
     $layoutLoaderDef->replaceArgument(0, array(array('name' => 'layout-test', 'file' => __DIR__ . '/../../Fixtures/loaders/layout.html.twig', 'translations' => array(array('locale' => 'fr', 'file' => __DIR__ . '/../../Fixtures/loaders/layout.fr.html.twig')))));
     $mailLoaderDef->replaceArgument(0, array(array('name' => 'mail-test', 'file' => __DIR__ . '/../../Fixtures/loaders/mail.html.twig', 'layout' => 'layout-test', 'translations' => array(array('locale' => 'fr', 'file' => __DIR__ . '/../../Fixtures/loaders/mail.fr.html.twig')))));
     // test
     $this->pass->process($container);
     $this->assertFalse($container->has('sonatra_mailer.loader.layout_twig'));
     $this->assertFalse($container->has('sonatra_mailer.loader.mail_twig'));
 }
开发者ID:sonatra,项目名称:SonatraMailerBundle,代码行数:28,代码来源:OptimizeTwigLoaderPassTest.php

示例10: addRepository

 /**
  * {@inheritdoc}
  */
 protected function addRepository(ContainerBuilder $container, MetadataInterface $metadata)
 {
     $reflection = new \ReflectionClass($metadata->getClass('model'));
     $translatableInterface = 'Sylius\\Component\\Translation\\Model\\TranslatableInterface';
     $translatable = interface_exists($translatableInterface) && $reflection->implementsInterface($translatableInterface);
     $repositoryClassParameterName = sprintf('%s.repository.%s.class', $metadata->getApplicationName(), $metadata->getName());
     $repositoryClass = $translatable ? 'Sylius\\Bundle\\TranslationBundle\\Doctrine\\ORM\\TranslatableResourceRepository' : 'Sylius\\Bundle\\ResourceBundle\\Doctrine\\ORM\\EntityRepository';
     if ($container->hasParameter($repositoryClassParameterName)) {
         $repositoryClass = $container->getParameter($repositoryClassParameterName);
     }
     if ($metadata->hasClass('repository')) {
         $repositoryClass = $metadata->getClass('repository');
     }
     $definition = new Definition($repositoryClass);
     $definition->setArguments(array(new Reference($metadata->getServiceId('manager')), $this->getClassMetadataDefinition($metadata)));
     if ($metadata->hasParameter('translation')) {
         $repositoryReflection = new \ReflectionClass($repositoryClass);
         $translatableRepositoryInterface = 'Sylius\\Component\\Translation\\Repository\\TranslatableResourceRepositoryInterface';
         $translationConfig = $metadata->getParameter('translation');
         if (interface_exists($translatableRepositoryInterface) && $repositoryReflection->implementsInterface($translatableRepositoryInterface)) {
             if (isset($translationConfig['fields'])) {
                 $definition->addMethodCall('setTranslatableFields', array($translationConfig['fields']));
             }
         }
     }
     $container->setDefinition($metadata->getServiceId('repository'), $definition);
 }
开发者ID:lingoda,项目名称:Sylius,代码行数:30,代码来源:DoctrineORMDriver.php

示例11: load

 /**
  * {@inheritdoc}
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $configuration = new Configuration();
     $config = $this->processConfiguration($configuration, $configs);
     $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('services.yml');
     foreach ($config['connections'] as $name => $values) {
         $def = new Definition();
         $def->setClass($container->getParameter('agentsib_sphinx.connection.class'));
         $params = array('host' => $values['host'], 'port' => $values['port']);
         if ($values['socket']) {
             $params['socket'] = $values['socket'];
         }
         $def->setArguments(array($name, $values['driver'], $params));
         $def->addMethodCall('addLogger', array(new Reference('agentsib_sphinx.logger')));
         $container->setDefinition(sprintf('agentsib_sphinx.%s.connection', $name), $def);
         $helperDef = new DefinitionDecorator('agentsib_sphinx.factory.helper');
         $helperDef->setFactoryClass($container->getParameter('agentsib_sphinx.helper.class'));
         $helperDef->setFactoryMethod('create');
         $helperDef->addArgument(new Reference(sprintf('agentsib_sphinx.%s.connection', $name)));
         $helperDef->setPublic(true);
         $container->setDefinition(sprintf('agentsib_sphinx.%s.helper', $name), $helperDef);
         if ($name == $config['default_connection']) {
             $container->setAlias('agentsib_sphinx.connection', sprintf('agentsib_sphinx.%s.connection', $name));
             $container->setAlias('agentsib_sphinx.helper', sprintf('agentsib_sphinx.%s.helper', $name));
         }
     }
 }
开发者ID:agentsib,项目名称:sphinx-bundle,代码行数:31,代码来源:AgentSIBSphinxExtension.php

示例12: buildTranslationStorageDefinition

 /**
  * Build the 'lexik_translation.translation_storage' service definition.
  *
  * @param ContainerBuilder $container
  * @param string           $storage
  * @param string           $objectManager
  */
 protected function buildTranslationStorageDefinition(ContainerBuilder $container, $storage, $objectManager)
 {
     $container->setParameter('lexik_translation.storage.type', $storage);
     if ('orm' == $storage) {
         if (isset($objectManager)) {
             $objectManagerReference = new Reference(sprintf('doctrine.orm.%s_entity_manager', $objectManager));
         } else {
             $objectManagerReference = new Reference('doctrine.orm.entity_manager');
         }
     } else {
         if ('mongodb' == $storage) {
             if (isset($objectManager)) {
                 $objectManagerReference = new Reference(sprintf('doctrine_mongodb.odm.%s_document_manager', $objectManager));
             } else {
                 $objectManagerReference = new Reference('doctrine.odm.mongodb.document_manager');
             }
         } else {
             if ('propel' == $storage) {
                 // In the Propel case the object_manager setting is used for the connection name
                 if (isset($objectManager)) {
                     $objectManagerReference = $objectManager;
                 } else {
                     $objectManagerReference = null;
                 }
             } else {
                 throw new \RuntimeException(sprintf('Unsupported storage "%s".', $storage));
             }
         }
     }
     $storageDefinition = new Definition();
     $storageDefinition->setClass(new Parameter(sprintf('lexik_translation.%s.translation_storage.class', $storage)));
     $storageDefinition->setArguments(array($objectManagerReference, array('trans_unit' => new Parameter(sprintf('lexik_translation.%s.trans_unit.class', $storage)), 'translation' => new Parameter(sprintf('lexik_translation.%s.translation.class', $storage)), 'file' => new Parameter(sprintf('lexik_translation.%s.file.class', $storage)))));
     $container->setDefinition('lexik_translation.translation_storage', $storageDefinition);
 }
开发者ID:StuartApp,项目名称:LexikTranslationBundle,代码行数:41,代码来源:LexikTranslationExtension.php

示例13: createServiceDefinitions

 /**
  * @inheritDoc
  */
 public function createServiceDefinitions(array $data, ContainerBuilder $container, $prefix)
 {
     if (!isset($data['host'])) {
         throw new UrlResolveException("No region hostname found in url");
     }
     if (!isset($data['user'])) {
         throw new UrlResolveException("No key (username) found in url");
     }
     if (!isset($data['pass'])) {
         throw new UrlResolveException("No secret (password) found in url");
     }
     if (!isset($data['clean_path'])) {
         throw new UrlResolveException("No bucket name (path) found in url");
     }
     $region = $data['host'];
     $key = $data['user'];
     $secret = $data['pass'];
     $bucket = $data['clean_path'];
     $adapterPrefix = null;
     if (isset($data['prefix'])) {
         $adapterPrefix = $data['prefix'];
     }
     $version = 'latest';
     if (isset($data['version'])) {
         $version = $data['version'];
     }
     $client = new Definition('Aws\\S3\\S3Client');
     $client->setFactory(['Aws\\S3\\S3Client', 'factory']);
     $client->setArguments([['credentials' => ['key' => $key, 'secret' => $secret], 'region' => $region, 'version' => $version]]);
     $container->setDefinition("{$prefix}.client", $client);
     $container->setDefinition("{$prefix}.adapter", new Definition('League\\Flysystem\\AwsS3v3\\AwsS3Adapter', [new Reference("{$prefix}.client"), $bucket, $adapterPrefix]));
     return "{$prefix}.adapter";
 }
开发者ID:bravesheep,项目名称:flysystem-url-bundle,代码行数:36,代码来源:AwsS3v3UrlResolver.php

示例14: Definition

 function it_processes_the_configuration_and_registers_services_per_variable(ContainerBuilder $container)
 {
     $variantFormType = new Definition('Some\\App\\Product\\Form\\ProductVariantType');
     $variantFormType->setArguments(array('Some\\App\\Product\\Entity\\ProductVariant', '%sylius.validation_group.product_variant%', 'product'))->addTag('form.type', array('alias' => 'sylius_product_variant'));
     $container->setDefinition('sylius.form.type.product_variant', $variantFormType)->shouldBeCalled();
     $variantChoiceFormType = new Definition('Sylius\\Bundle\\VariationBundle\\Form\\Type\\VariantChoiceType');
     $variantChoiceFormType->setArguments(array('product'))->addTag('form.type', array('alias' => 'sylius_product_variant_choice'));
     $container->setDefinition('sylius.form.type.product_variant_choice', $variantChoiceFormType)->shouldBeCalled();
     $variantMatchFormType = new Definition('Sylius\\Bundle\\VariationBundle\\Form\\Type\\VariantMatchType');
     $variantMatchFormType->setArguments(array('product'))->addTag('form.type', array('alias' => 'sylius_product_variant_match'));
     $container->setDefinition('sylius.form.type.product_variant_match', $variantMatchFormType)->shouldBeCalled();
     $optionFormType = new Definition('Some\\App\\Product\\Form\\OptionType');
     $optionFormType->setArguments(array('Some\\App\\Product\\Entity\\Option', '%sylius.validation_group.product_option%', 'product'))->addTag('form.type', array('alias' => 'sylius_product_option'));
     $container->setDefinition('sylius.form.type.product_option', $optionFormType)->shouldBeCalled();
     $optionChoiceFormType = new Definition('Sylius\\Bundle\\VariationBundle\\Form\\Type\\OptionEntityChoiceType');
     $optionChoiceFormType->setArguments(array('product', 'Some\\App\\Product\\Entity\\Option'))->addTag('form.type', array('alias' => 'sylius_product_option_choice'));
     $container->setDefinition('sylius.form.type.product_option_choice', $optionChoiceFormType)->shouldBeCalled();
     $optionValueFormType = new Definition('Some\\App\\Product\\Form\\OptionValueType');
     $optionValueFormType->setArguments(array('Some\\App\\Product\\Entity\\OptionValue', '%sylius.validation_group.product_option_value%', 'product'))->addTag('form.type', array('alias' => 'sylius_product_option_value'));
     $container->setDefinition('sylius.form.type.product_option_value', $optionValueFormType)->shouldBeCalled();
     $optionValueChoiceFormType = new Definition('Sylius\\Bundle\\VariationBundle\\Form\\Type\\OptionValueChoiceType');
     $optionValueChoiceFormType->setArguments(array('product'))->addTag('form.type', array('alias' => 'sylius_product_option_value_choice'));
     $container->setDefinition('sylius.form.type.product_option_value_choice', $optionValueChoiceFormType)->shouldBeCalled();
     $optionValueCollectionFormType = new Definition('Sylius\\Bundle\\VariationBundle\\Form\\Type\\OptionValueCollectionType');
     $optionValueCollectionFormType->setArguments(array('product'))->addTag('form.type', array('alias' => 'sylius_product_option_value_collection'));
     $container->setDefinition('sylius.form.type.product_option_value_collection', $optionValueCollectionFormType)->shouldBeCalled();
     $variables = array('product' => array('variable' => 'Some\\App\\Product\\Entity\\Product', 'option' => array('model' => 'Some\\App\\Product\\Entity\\Option', 'form' => 'Some\\App\\Product\\Form\\OptionType'), 'option_value' => array('model' => 'Some\\App\\Product\\Entity\\OptionValue', 'form' => 'Some\\App\\Product\\Form\\OptionValueType'), 'variant' => array('model' => 'Some\\App\\Product\\Entity\\ProductVariant', 'form' => 'Some\\App\\Product\\Form\\ProductVariantType')));
     $container->setParameter('sylius.variation.variables', $variables)->shouldBeCalled();
     $userConfig = array('driver' => SyliusResourceBundle::DRIVER_DOCTRINE_ORM, 'classes' => array('product' => array('variable' => 'Some\\App\\Product\\Entity\\Product', 'option' => array('model' => 'Some\\App\\Product\\Entity\\Option', 'form' => 'Some\\App\\Product\\Form\\OptionType'), 'option_value' => array('model' => 'Some\\App\\Product\\Entity\\OptionValue', 'form' => 'Some\\App\\Product\\Form\\OptionValueType'), 'variant' => array('model' => 'Some\\App\\Product\\Entity\\ProductVariant', 'form' => 'Some\\App\\Product\\Form\\ProductVariantType'))));
     $processedConfig = array('driver' => SyliusResourceBundle::DRIVER_DOCTRINE_ORM, 'classes' => array('product_option' => array('model' => 'Some\\App\\Product\\Entity\\Option', 'form' => 'Some\\App\\Product\\Form\\OptionType'), 'product_option_value' => array('model' => 'Some\\App\\Product\\Entity\\OptionValue', 'form' => 'Some\\App\\Product\\Form\\OptionValueType'), 'product_variant' => array('model' => 'Some\\App\\Product\\Entity\\ProductVariant', 'form' => 'Some\\App\\Product\\Form\\ProductVariantType')), 'validation_groups' => array('product_variant' => array('sylius'), 'product_option' => array('sylius'), 'product_option_value' => array('sylius')));
     $this->process($userConfig, $container)->shouldReturn($processedConfig);
 }
开发者ID:Avazanga1,项目名称:Sylius,代码行数:32,代码来源:SyliusVariationExtensionSpec.php

示例15: configure

 /**
  * {@inheritDoc}
  */
 public function configure($name, array $config, Definition $service, ContainerBuilder $container)
 {
     $sqlite3Conf = $config['sqlite3'];
     $tableName = $sqlite3Conf['table_name'];
     $connectionRef = $this->getConnectionReference($name, $sqlite3Conf, $container);
     $service->setArguments(array($connectionRef, $tableName));
 }
开发者ID:tsurune,项目名称:Pruebas,代码行数:10,代码来源:Sqlite3Definition.php


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