Login | Register
My pages Projects Community openCollabNet

propel
Reply to message

* = Required fields
* Subject
* Body
Attachments
Send reply to
Topic
Author (directly in email)
Please type the letters in the image above.

Original message

Author hlellelid
Full name Hans Lellelid
Date 2007-11-15 15:28:03 PST
Message Hi Ron,

<snip>
> Both table foo and bar have the saver handler for the onCreate and
> onSave event. I intent to implement the event / handler structure using
> the observer pattern, Propel objects being Observables and event
> handlers being Observers. The saver handler (observer) would be an
> example where the onCreate event registers the propel object with the
> handler and the onSave triggers save on all registered objects. This way
> you can save multiple objects with a single save() call, potentially
> this means you could tweak things so that you would add or update many
> objects in a single sql query.
> I know many of the things this will make possible are already possible
> by overriding functions in the propel classes. I do believe however,
> that this mechanism would prove to be very flexible and easier to
> maintain than implementations in propel classes (I still have a whole
> lot of classes where I need to change save(PDO $con = nul) to
> save(PropelPDO $con = null)).
> I'll be starting to build this shortly, anyone having suggestions,
> improvements, seeing upfront bottlenecks, just let me know and if I
> think it makes sense I'll try to do something useful with it ;)
>

Yeah, I think this is what Symfony is doing w/ Propel. I believe they
have extended the builder classes to wrap the various methods to fire
pre/post events. They call this "mixins" (I guess it's a bit AOP like).
  You may wish to start from their implementation. I'm open to us
including a version of this directly in Propel too (maybe ability to
enable/disable the code would be nice too). I think it's a useful idea.

Hans