In:
http://www.symfony-project.com/book/trunk/17-Extending-Symfony
"Be aware that you cannot override the generated model classes of a
plug-in in your own project directories."

I chose to comply with that at the time, but was in fact able to do so
with propel (through some trickery). Now that doctrine is starting to
come on to the scene, it's even easier and more straight forward.

I want to develop several plugins w/ sfDoctrine, but I want to be able
to extend (via inheritance) their classes for specific customization
w/in my projects.

Ex:

/plugins/pluginUser/config/doctrine/schema.yml
pluginUser:
  tableName: user
  columns:
    active: {type: boolean, notnull: true, default: false}
    created_at: {type: timestamp}
    updated_at: {type: timestamp}
    login: {type: string(32), notnull: true, unique: true}
    password: {type: string(255)}
    salt: {type: string(255)}
    email: {type: string(150), unique: true, email: true}
    login_count: {type: integer, unsigned: true, notnull: true, default:
0}
    last_login: {type: timestamp}
    password_activiation: {type: string(255)}
    email_activation: {type: string(255)}


/config/doctrine/schema.yml
myUser:
  inheritance: {extends: pluginUser}
  columns:
    avatar: {type: string(255)}

Let's say that in some case, my plugin is to return an instance of a
pluginUser. I would prefer if it would instead return an instance of
myUser, thus allowing my new fields to be available, as well as any
overridden methods. 

I would probably suggest setting the table names for the plugin via the
project, thus overriding the plugin. Then, the plugin would be built
with that in mind, and would pull the table name via the configuration
settings.

Ex: (purely speculative)

/plugins/pluginUser/config/app.yml
all:
  pluginUser:
    doctrine:
      classNames:
        pluginUser: pluginUser
        pluginGroup: pluginGroup
        pluginRole: pluginRole


/config/app.yml
all:
  pluginUser:
    doctrine:
      classNames:
        pluginUser: myUser
        pluginGroup: myGroup
        pluginRole: myRole


I have not investigated this completely to know if this will work or
not, but I'll check it out over the next day or so. 

My request to you all:
--- Do you know if this will work? 
--- Do you know a better or proven way for this to work? 
--- Do you agree with the 'best practice' outlined here?

+/- on this if this is an unexplored concept as of yet.

Thanks!
~synace



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony developers" group.
To post to this group, send email to symfony-devs@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/symfony-devs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to