多对多学说不起作用

发布于 2024-11-18 15:47:37 字数 2177 浏览 2 评论 0原文

我有以下 schema.yml 文件,但它无法正常工作。有人能指出我正确的方向吗?

ClientPaymentService:
    actAs: { Timestampable: ~ }
    columns:
        clientId: integer
        name: { type: string(100), notnull: true, unique: true }
        paymentServiceId: integer
        config: { type: string(4096), notnull: true }
        cardFormatId: integer
    relations:
        Client:
            local: clientId
            foreign: id
            type: many
            foreignType: one
            foreignAlias: Client
        PaymentService:
            local: paymentServiceId
            foreign: id
            type: many
            foreignType: one
            foreignAlias: ClientPaymentService
        CardFormat:
            local: cardFormatId
            foreign: id
            type: many
            foreignType: one
            foreignAlias: ClientCardFormats
        CountryCode:
            class: CountryCode
            refClass: ClientPaymentServiceCountryCode
            foreign: id            # country_code_id also doesn't work
            local: id

ClientPaymentServiceCountryCode:
    columns:
        client_payment_service_id:
            type: integer
            primary: true
        country_code_id:
            type: integer
            primary: true
    relations:
        ClientPaymentService:
            local: client_payment_service_id
            foreign: id
            foreignAlias: ClientPaymentServiceCountryCodes
        CountryCode:
            local: country_code_id
            foreign: id
            foreignAlias: ClientPaymentServiceCountryCodes

CountryCode:
    actAs: { Timestampable: ~ }
    columns:
        name: { type: string(100), notnull: true, unique: true }
        code: { type: string(10), notnull: true, unique: true }
    relations:
        ClientPaymentService:
            class: ClientPaymentService
            refClass: ClientPaymentServiceCountryCode
            local: id
            foreign: id        # client_payment_service_id also doesn't work

尝试在管理区域中保存某些内容时,我收到以下错误:

Unknown record property / related component "id" on "ClientPaymentServiceCountryCode"

谢谢

I've got the following schema.yml file, but it's just not working correctly. Can anyone point me in the right direction please?

ClientPaymentService:
    actAs: { Timestampable: ~ }
    columns:
        clientId: integer
        name: { type: string(100), notnull: true, unique: true }
        paymentServiceId: integer
        config: { type: string(4096), notnull: true }
        cardFormatId: integer
    relations:
        Client:
            local: clientId
            foreign: id
            type: many
            foreignType: one
            foreignAlias: Client
        PaymentService:
            local: paymentServiceId
            foreign: id
            type: many
            foreignType: one
            foreignAlias: ClientPaymentService
        CardFormat:
            local: cardFormatId
            foreign: id
            type: many
            foreignType: one
            foreignAlias: ClientCardFormats
        CountryCode:
            class: CountryCode
            refClass: ClientPaymentServiceCountryCode
            foreign: id            # country_code_id also doesn't work
            local: id

ClientPaymentServiceCountryCode:
    columns:
        client_payment_service_id:
            type: integer
            primary: true
        country_code_id:
            type: integer
            primary: true
    relations:
        ClientPaymentService:
            local: client_payment_service_id
            foreign: id
            foreignAlias: ClientPaymentServiceCountryCodes
        CountryCode:
            local: country_code_id
            foreign: id
            foreignAlias: ClientPaymentServiceCountryCodes

CountryCode:
    actAs: { Timestampable: ~ }
    columns:
        name: { type: string(100), notnull: true, unique: true }
        code: { type: string(10), notnull: true, unique: true }
    relations:
        ClientPaymentService:
            class: ClientPaymentService
            refClass: ClientPaymentServiceCountryCode
            local: id
            foreign: id        # client_payment_service_id also doesn't work

I receive the following error when trying to save something in the admin area:

Unknown record property / related component "id" on "ClientPaymentServiceCountryCode"

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

停滞 2024-11-25 15:47:37

尝试这个关联:

ClientPaymentService:
.....
    CountryCode:
        class: CountryCode
        refClass: ClientPaymentServiceCountryCode
        foreign: country_code_id         # country_code_id also doesn't work
        local: client_payment_service_id # you must define both directions

ClientPaymentServiceCountryCode:
    columns:
        client_payment_service_id:
            type: integer
            primary: true
        country_code_id:
            type: integer
            primary: true
    // you not have to define relations here

CountryCode:
   ....
        ClientPaymentService:
            class: ClientPaymentService
            refClass: ClientPaymentServiceCountryCode
            local: country_code_id
            foreign: client_payment_service_id      

我刚刚遵循文档:
http://www.doctrine-project.org/projects/orm/1.2/docs/manual/defining-models/ru#relationships:join-table-associations:many-to-many

Try this association:

ClientPaymentService:
.....
    CountryCode:
        class: CountryCode
        refClass: ClientPaymentServiceCountryCode
        foreign: country_code_id         # country_code_id also doesn't work
        local: client_payment_service_id # you must define both directions

ClientPaymentServiceCountryCode:
    columns:
        client_payment_service_id:
            type: integer
            primary: true
        country_code_id:
            type: integer
            primary: true
    // you not have to define relations here

CountryCode:
   ....
        ClientPaymentService:
            class: ClientPaymentService
            refClass: ClientPaymentServiceCountryCode
            local: country_code_id
            foreign: client_payment_service_id      

I have just follow documentation :
http://www.doctrine-project.org/projects/orm/1.2/docs/manual/defining-models/ru#relationships:join-table-associations:many-to-many

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文