Search code examples
phpsymfony-1.4symfony-plugins

Linking sfDoctrineGuardPlugin with my own model schema


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


Solution

  • 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