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