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


PHP SerializerBuilder::addMetadataDir方法代码示例

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


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

示例1: build

 public function build()
 {
     $this->setObjectManager($this->createEntityManager());
     $this->serializerBuilder = BreezeSerializerBuilder::create($this->getObjectManager());
     $this->validatorBuilder = new ValidatorBuilder();
     if ($this->annotationsEnabled) {
         $this->validatorBuilder->enableAnnotationMapping();
     }
     foreach ($this->mappings as $mapping) {
         if (isset($mapping['serializer'])) {
             $this->serializerBuilder->addMetadataDir($mapping['serializer']);
         }
         if (isset($mapping['validation'])) {
             if ($mapping['type'] == 'xml') {
                 $this->validatorBuilder->addXmlMapping($mapping['validation']);
             } else {
                 if ($mapping['type'] == 'yaml') {
                     $this->validatorBuilder->addYamlMapping($mapping['validation']);
                 }
             }
             //                else if ($mapping['type'] == 'annotation') {
             //                    $this->validatorBuilder->enableAnnotationMapping();
             //                }
         }
     }
     $serializer = $this->serializerBuilder->build();
     $this->setSerializer($serializer);
     $validator = $this->validatorBuilder->getValidator();
     $this->setValidator($validator);
 }
开发者ID:s001dxp,项目名称:breeze.server.php,代码行数:30,代码来源:StandaloneApplication.php

示例2: __construct

 /**
  * @param array $options
  */
 public function __construct($options)
 {
     $this->options = $options;
     $builder = new SerializerBuilder();
     $this->serializer = $builder->addMetadataDir(realpath(__DIR__ . '/../Resources/serializer'))->build();
 }
开发者ID:adezandee,项目名称:shopify-bundle,代码行数:9,代码来源:ShopifyExporter.php

示例3: registerXApiMetadata

 /**
  * Registers serialization metadata for the xAPI models on a SerializerBuilder.
  *
  * @param SerializerBuilder $builder The SerializerBuilder
  */
 public static function registerXApiMetadata(SerializerBuilder $builder)
 {
     $builder->addMetadataDir(static::getMetadataDirectory(), 'Xabbuh\\XApi\\Model');
 }
开发者ID:xabbuh,项目名称:xapi-serializer,代码行数:9,代码来源:Serializer.php

示例4: setUp

 public function setUp()
 {
     $this->storeKey = array('api_key' => '0e54680857cc2874d9f3874364d786c3', 'password' => '8ad3f0ee9cec0c559046f273dd22350c', 'secret' => '139bfc86c90a8893e0bb97560a5e0e4a', 'domain' => 'symfony-shopify-bundle.myshopify.com');
     $builder = new SerializerBuilder();
     $this->serializer = $builder->addMetadataDir(realpath(__DIR__ . '/../Resources/serializer'))->build();
 }
开发者ID:adezandee,项目名称:shopify-bundle,代码行数:6,代码来源:ShopifyTestCase.php


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