2016-07-26 22 views
1

我是Sylius新手我正在使用Rest API。 我的问题:我们如何覆盖序列化文件以公开更多文件。 例如:Sylius:重写串行器配置“Model.Product.yml”以显示更多文件

供应商/ sylius/sylius/src目录/ Sylius /包/ ProductBundle /资源/配置/串行器/ Model.Product.yml

当我加入一些领域的原型和测试翻译他们完美地工作

Sylius\Component\Product\Model\Product: 
exclusion_policy: ALL 
xml_root_name: product 
properties: 
    id: 
     expose: true 
     type: integer 
     xml_attribute: true 
    name: 
     expose: true 
     type: string 
    description: 
     expose: true 
     type: string 
    attributes: 
     expose: true 
     max_depth: 2 
    createdAt: 
     expose: true 
     type: DateTime 
    updatedAt: 
     expose: true 
     type: DateTime 
    archetype: 
     expose: 
     serialized_name: archetypes 
    translations: 
     expose: true 
     serialized_name: translations 
virtual_properties: 
    getVariants: 
     serialized_name: variants 

如何覆盖此配置?

回答

1

,必须先创建自己的包扩展核心一个(假设你正在使用的Sylius标准版)

然后覆盖的产品型号,下面http://docs.sylius.org/en/latest/customization/model.html - >应位于YourBundle \实体\产品.php

最后,创建Resources \ config \ serializer \ Entity.Product.yml并在这里执行任何你想要的操作:)

相关问题