嵌入式的学说覆盖列名称

时间:2018-11-27 10:38:26

标签: symfony doctrine

是否可以覆盖嵌入式列的名称? 我想在数据库上将客户奖金列名称保持为customer_earnings而不是customer_total

Api\Comerce\Domain\Expenses:
    type: embeddable
    embedded:
        personalCommission:
            class: Shared\Domain\ValueObjects\AppliedPercentage
            columnPrefix: personal_
        customerBonus:
            attributeOverride:
                value:
                    column: customer_earnings
            class: Shared\Domain\ValueObjects\AppliedPercentage
            columnPrefix: customer_

Shared\Domain\ValueObjects\AppliedPercentage:
    type: embeddable
    fields:
        value:
            type: decimal
            nullable: true
            precision: 7
            scale: 2
            column: total 
        percentage:
            type: integer
            nullable: true
            options:
                unsigned: false
            column: percentage

1 个答案:

答案 0 :(得分:1)

不幸的是,该学说不支持嵌入式列替换。您只能更改columnPrefix。如果仍然需要单独的列名,则可以考虑为此目的创建不同的类。