Hello

I'm currently working on a patch to sfDoctrine to follow the new
templates/listener stuff in doctrine.

the basic idea is that the current created_at/updated_at fields in
sfDoctrineRecord are preInsert-ed and preUpdate-d even if they do not
exists, and even if they're not timestamp fields. Little overhead results in
first case, and in second case (for example if it's unix timestamp fields)
you cannot set the global behaviour for all your model, but must override
sfDoctrineRecord::set and ::get methods for every model class that needs it
(this is a new problem that did not exists when it was filters, but i guess
the overhead caused by filter solution was too big, and that was not a real
solution neither because you execute code for it even if the current model
class does not need such behaviour)

So, the real doctrine solution, imho, would be to add in the
schema.ymlfile, an optional parameter to choose which behaviour
templates (cf doctrine
documentation about templates:
http://doctrine.pengus.net/doctrine/manual/new/?chapter=class-templates )
you'd like to implement in your model class with sfDoctrine***Template
classes provided to imitate propel behaviour.

For example, old fashion, without using doctrine's new powerfull features:

User:
  tableName: account
  columns:
    login: string(20)
    password: string(20)
    created_at: timestamp
    updated_at: timestamp

New fashion, once patch will be finished:

User:
  tableName: account
  templates: [ timestamp ]
  columns:
    login: string(20)
    password: string(20)

Which would automagically add created_at and updated_at fields, and add them
a listener for onPreInsert and onPreUpdate events.

I'd like to have some feedback on this, as it breaks some B/C, but removes
big limits in overriding possibilities (fun how that's propel anti BC-break
hacks that bring such limitations), and adds some great new features of
doctrine into sfDoctrineSchema.


-- 

Best regards

Romain

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

Reply via email to