开发者

Doctrine inheritance not inserting record into parent table

I've got the following database structure:

Account:
    columns:
        email: string(255)
        name:
            type: string(255)

UserRegistered:
    columns:
        email:
            type: string(255)
            email: true
            notnull: true
            unique: true
        username:
            type: string(255)
            notnull: true
            nospace: true
            unique: true
            minlength: 5
        password:
            type: string(255)
        token: string(255)
    inheritance:
        extends: Account
        type: concrete

UserOpenid:
   columns:
       openid: string(255)
       openid_provider: string(255)
   inheritance:
       extends: Account
       type: concrete

When I insert a new UserRegistered or UserOpenid record, I would've expected it to create a UserRegistered record as well as an Account record.

Did I misunderstand inheritance / am I mis开发者_JS百科using it, or have I done something wrong?


If you use concrete inheritance the master table will always be empty. All fields from the master table are duplicated in the child tables.. therefore there is no need to write to the master table.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜