On 14 Apr 2006 11:21:50 -0400, Ted Zlatanov <[EMAIL PROTECTED]> wrote:
> On 14 Mar 2006, [EMAIL PROTECTED] wrote:
>> Can you think of a good way to pass custom manager_args to individual calls
>> to a relationship accessor?  Maybe a new read-only accessor type where
>> arguments can't possible be meant to set values?
>
> Maybe this will work:
>
> $company->products({ id => 123 }, { id => 456 },
>                    [ sort_by => whatever]);

As I alluded to earlier, there's a semantic disconnect between methods
like products() that manipulate a fixed set of related objects, and
the proposed usage scenario where you call a method with arbitrary
filter arguments.

Remember, products() doesn't just return a bunch of related objects. 
It loads a bunch of related objects and stores them in an object
attribute named "products," then it returns that list.  If that list
already exists (e.g., because products() was called earlier) then it
just returns the existing list.

The contents of that list is set in the relationship definition, and
must be fixed in order for the "object attribute" semantics to make
sense.  Now, sorting doesn't really change the contents of the list,
but think about what'd happen if you asked for a subset of the list by
passing some filter conditions.    What should happen?  Should that
subset be stored as the new list?  If you save(), should that subset
replace the entire existing (sans conditions) list?  It's a mismatch
in functionality that leads to some situations where there is no
sensible choice.

I think this topic needs to be reframed in terms of what the user is
trying to accomplish.  Modifying the nature of a set of related
objects on a per-call basis doesn't make much sense with any of the
existing object attribute method types.  If you merely want to fetch a
set of objects given arbitrary search criteria, then perhaps a new
method type that wraps a Manager call would be more appropriate.

-John


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642
_______________________________________________
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object

Reply via email to