开发者

Linking sfDoctrineGuardPlugin with my own model schema

开发者 https://www.devze.com 2023-03-28 08:00 出处:网络
Im developing kind of a plugin for an already working system, and i intend to use symfony. My plugin requires authentication, and i want to use the开发者_如何转开发 symfony sfDoctrineGuardPlugin. I ge

Im developing kind of a plugin for an already working system, and i intend to use symfony. My plugin requires authentication, and i want to use the开发者_如何转开发 symfony sfDoctrineGuardPlugin. I generated the schema.yaml from the existing database, using the command: $ php symfony doctrine:build-schema, where i had already modeled my user table, with some fields i needed, and foreign keys to other tables.

When i installed the mentioned plugin, i realized it creates its own schema, separated from mine. Is there any way to add fields to sfDoctrineGuardPlugin's user table? can i make foreign keys in this table? can i reference this table from other tables? I need a way to fully customize the user table and class created by the plugin...

Thank you very much for your attention and help!!!


The materials you got from LuisClemente are enough.

To add references you use usual way to do it.

schema.yml:

  sfGuardUser:
    columns:
      personal_info_id: { type: integer(5), notnull: false }    
    relations:
      PersonalInfo:
        class: PPersonalInfo
        local: personal_info_id
        foreign: id
        onDelete: CASCADE

  PPersonalInfo:
    columns:
      last_name:          { type: string(127), notnull: false }
      first_name:       { type: string(127), notnull: false }

For more info see symfony blog


Maybe this can help you:

sfGuardPlugin documentation

Adding to the sfDoctrineGuardPlugin

Search "Customize the sfGuardUser model" inside the first document. I don't know if I understand your question but I followed such documentation to add fields to my guardUser (I use Propel)

Regards

0

精彩评论

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

关注公众号