Linking sfDoctrineGuardPlugin with my own model schema

379 Views Asked by At

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!!!

2

There are 2 best solutions below

4
On BEST ANSWER

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

4
On

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