Serializing entity's custom fields in sylius

时间:2018-02-07 16:55:32

标签: symfony sylius jmsserializerbundle

I have extended entity user.

namespace MyShop\CoreBundle\Entity;

use Sylius\Component\Core\Model\User as BaseUser;

class User extends BaseUser

Next, I want to expose email and exclude, for example, id field. How should I config these conditions?

I found this solution中提取href并在app/config/config.yml中添加配置:

jms_serializer:
    metadata:
        directories:
            myshop-user:
                namespace_prefix: "MyShop\\CoreBundle\\Entity"
                path: "@MyShopCoreBundle/Resources/config/serializer"

但是sylius没有看到我的MyShop/CoreBundle/Resources/config/serializer/Model.User.yml

MyShop\CoreBundle\Entity\User:
    exclusion_policy: ALL
    xml_root_name: user
    properties:destroyyamlfile
        id:
            expose: false
            type: integer
        email:
            expose: true
            type: string

我故意摧毁它,但框架运作良好,并没有看到我错误的版本。

那么应该如何在app/config/config.ymlModel.User.yml ??

中查看我的配置

0 个答案:

没有答案