How does one add a custom method to a plugin model class now? As far as
I know, there's no way to.


I propose allowing a project to define a set of code that can be
included into the model during build time.

---
example: (albeit a bad one, because technically this mod can be
performed w/ a static method outside the model file that doesn't require
'private' access to $this)..

sfGuardUser has a field: last_login.

And I want to add a method, sfGuardUser->getTimeSinceLastLogin()
---

I propose that you can define code, such as:

public function getTimeSinceLastLogin()
{
        return time() - $this->getLastLogin();
}

Now, during build, this method would be written into the base model
file.
---

I came across this need when I realised that if I link my tables to a
plugin table via a FK relationship, the plugin's base model files are
updated to include associations with my project. Thus allowing me to do
things like joins against my project-specific tables.

I have a dilema in that I'm reusing a plugin for many sites, but it'd be
very easy to customize if I could add methods (with private scope) that
I could do different things with, such as performing customized logic on
some newly linked tables (from my project).


Thoughts... Alternatives... Best Practices? Or am I completely wrong
here?



Ooh, side note, I notice that I don't have package="" on my table
definitions in my plugin directories, only my database definition. Dunno
if this is a side effect or whatever. I'm going to give that a shot and
see what else I can do.

~synace



--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups 
"symfony developers" 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-devs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to