Welcome Guest, Not a member yet? Register   Sign In
Nested SQL function calls on related field with DataMapper?
#3

[eluser]Dracos[/eluser]
Well, I got around the nested part by using stored functions. I'm still in a situation where I need to do WHERE ... BETWEEN ... FUNC in DM, but I can use WHERE ... <= AND WHERE >= instead, but I'd still rather use BETWEEN.

I realized that I need to query $other directly anyway; I can use that to get the $obj fields via include_related(), of course.

In the DM class, where_between_field_func is mentioned in a comment, but appears nowhere in the code. I've looked at DataMapper::__call(), but can't see how where_between_field_func could distinguish the function arguments from the BETWEEN operands.

Now I see that where_related_field_func() does not exist, and even if it did, __call() seems like it would return something unexpected. Doubly so for where_between_related_field_func.

However, this alternative approach will only solve this simple piece of the greater query, which actually involves up to 9 models and occasionally as many as 4 join tables.


Messages In This Thread
Nested SQL function calls on related field with DataMapper? - by El Forum - 04-01-2014, 02:12 PM



Theme © iAndrew 2016 - Forum software by © MyBB