當前位置: 首頁>>代碼示例>>PHP>>正文


PHP MetadataInterface::getDriver方法代碼示例

本文整理匯總了PHP中Sylius\Component\Resource\Metadata\MetadataInterface::getDriver方法的典型用法代碼示例。如果您正苦於以下問題:PHP MetadataInterface::getDriver方法的具體用法?PHP MetadataInterface::getDriver怎麽用?PHP MetadataInterface::getDriver使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Sylius\Component\Resource\Metadata\MetadataInterface的用法示例。


在下文中一共展示了MetadataInterface::getDriver方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1:

 function it_defines_resource_options(OptionsResolver $resolver, MetadataInterface $metadata)
 {
     $metadata->getDriver()->willReturn(SyliusResourceBundle::DRIVER_DOCTRINE_ORM);
     $resolver->setDefaults(['class' => null])->shouldBeCalled()->willReturn($resolver);
     $resolver->setNormalizer('class', Argument::type('callable'))->shouldBeCalled()->willReturn($resolver);
     $this->configureOptions($resolver);
 }
開發者ID:gabiudrescu,項目名稱:Sylius,代碼行數:7,代碼來源:ResourceChoiceTypeSpec.php

示例2: get

 /**
  * @param MetadataInterface $metadata
  *
  * @return DriverInterface
  *
  * @throws UnknownDriverException
  */
 public static function get(MetadataInterface $metadata)
 {
     $type = $metadata->getDriver();
     if (isset(self::$drivers[$type])) {
         return self::$drivers[$type];
     }
     switch ($type) {
         case SyliusResourceBundle::DRIVER_DOCTRINE_ORM:
             return self::$drivers[$type] = new DoctrineORMDriver();
         case SyliusResourceBundle::DRIVER_DOCTRINE_MONGODB_ODM:
             return self::$drivers[$type] = new DoctrineODMDriver();
         case SyliusResourceBundle::DRIVER_DOCTRINE_PHPCR_ODM:
             return self::$drivers[$type] = new DoctrinePHPCRDriver();
     }
     throw new UnknownDriverException($type);
 }
開發者ID:bendavies,項目名稱:Sylius,代碼行數:23,代碼來源:DriverProvider.php

示例3: getParent

 /**
  * {@inheritdoc}
  */
 public function getParent()
 {
     return $this->getFormTypeForDriver($this->metadata->getDriver());
 }
開發者ID:sylius,項目名稱:sylius,代碼行數:7,代碼來源:ResourceChoiceType.php

示例4: debugResource

 /**
  * @param MetadataInterface $metadata
  * @param OutputInterface $output
  */
 private function debugResource(MetadataInterface $metadata, OutputInterface $output)
 {
     $table = new Table($output);
     $information = ['name' => $metadata->getName(), 'application' => $metadata->getApplicationName(), 'driver' => $metadata->getDriver()];
     $parameters = $this->flattenParameters($metadata->getParameters());
     foreach ($parameters as $key => $value) {
         $information[$key] = $value;
     }
     foreach ($information as $key => $value) {
         $table->addRow([$key, $value]);
     }
     $table->render();
 }
開發者ID:loic425,項目名稱:Sylius,代碼行數:17,代碼來源:DebugResourceCommand.php

示例5: addForms

 /**
  * @param ContainerBuilder $container
  * @param MetadataInterface $metadata
  */
 protected function addForms(ContainerBuilder $container, MetadataInterface $metadata)
 {
     foreach ($metadata->getClass('form') as $formName => $formClass) {
         $suffix = 'default' === $formName ? '' : sprintf('_%s', $formName);
         $alias = sprintf('%s_%s%s', $metadata->getApplicationName(), $metadata->getName(), $suffix);
         $definition = new Definition($formClass);
         switch ($formName) {
             case 'choice':
                 $definition->setArguments([$metadata->getClass('model'), $metadata->getDriver(), $alias]);
                 break;
             default:
                 $validationGroupsParameterName = sprintf('%s.validation_groups.%s%s', $metadata->getApplicationName(), $metadata->getName(), $suffix);
                 $validationGroups = new Parameter($validationGroupsParameterName);
                 if (!$container->hasParameter($validationGroupsParameterName)) {
                     $validationGroups = ['Default'];
                 }
                 $definition->setArguments([$metadata->getClass('model'), $validationGroups]);
                 break;
         }
         $definition->addTag('form.type', ['alias' => $alias]);
         $container->setParameter(sprintf('%s.form.type.%s%s.class', $metadata->getApplicationName(), $metadata->getName(), $suffix), $formClass);
         $container->setDefinition(sprintf('%s.form.type.%s%s', $metadata->getApplicationName(), $metadata->getName(), $suffix), $definition);
     }
     if (!$container->hasDefinition(sprintf('%s.form.type.%s', $metadata->getApplicationName(), $metadata->getName()))) {
         $this->addDefaultForm($container, $metadata);
     }
 }
開發者ID:ahmadrabie,項目名稱:Sylius,代碼行數:31,代碼來源:AbstractDriver.php


注:本文中的Sylius\Component\Resource\Metadata\MetadataInterface::getDriver方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。