I'd like to have something like a calculated field in my record
object, something that is figured out by php rather than actually part
of the data. I know I can do this with a Listener implementing a
preHydrate call, but is there a simpler way to do it? Seems a bit
convoluted to create a new class just to implement a listener that
sets one variable. Is there something I can just put in my class to do
this, the equivalent of rails:
class ...
def specialfield
...
where I can then call class.specialfield. I tried this in php and it
does work but you have to call the method as a method, and we're
encoding this to sent to a javascript ajax request so I need it to
actually be considered a data item and not a method I can call on it.
Currently the only way is with a hydration listener. Maybe this is a feature worth implementing though. Can you create a ticket to record it? we can talk about it for a future version.
On Wed, Jul 2, 2008 at 3:38 PM, debtman7 <debt...@gmail.com> wrote:
> Hi,
> I'd like to have something like a calculated field in my record > object, something that is figured out by php rather than actually part > of the data. I know I can do this with a Listener implementing a > preHydrate call, but is there a simpler way to do it? Seems a bit > convoluted to create a new class just to implement a listener that > sets one variable. Is there something I can just put in my class to do > this, the equivalent of rails:
> class ...
> def specialfield > ...
> where I can then call class.specialfield. I tried this in php and it > does work but you have to call the method as a method, and we're > encoding this to sent to a javascript ajax request so I need it to > actually be considered a data item and not a method I can call on it.
FYI, the way I've gotten around this currently is to have a global
HydrationListener at the connection level that checks to see if the
Invoker has a preHydrate method and calls it if it does, passing the
data by reference. Not ideal but it does what we need for now.
On Jul 3, 9:38 am, "Jonathan Wage" <jonw...@gmail.com> wrote:
> Currently the only way is with a hydration listener. Maybe this is a feature
> worth implementing though. Can you create a ticket to record it? we can talk
> about it for a future version.
> Thanks, Jon
> On Wed, Jul 2, 2008 at 3:38 PM, debtman7 <debt...@gmail.com> wrote:
> > Hi,
> > I'd like to have something like a calculated field in my record
> > object, something that is figured out by php rather than actually part
> > of the data. I know I can do this with a Listener implementing a
> > preHydrate call, but is there a simpler way to do it? Seems a bit
> > convoluted to create a new class just to implement a listener that
> > sets one variable. Is there something I can just put in my class to do
> > this, the equivalent of rails:
> > class ...
> > def specialfield
> > ...
> > where I can then call class.specialfield. I tried this in php and it
> > does work but you have to call the method as a method, and we're
> > encoding this to sent to a javascript ajax request so I need it to
> > actually be considered a data item and not a method I can call on it.