Re: [RDBO] sorted relationship output?

2006-03-14 Thread John Siracusa
On 3/14/06 8:12 AM, Uwe Voelker 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?
 
 Is it possible to make a second accessor for the same relationship, a la
 products_by_id() versus products_by_name()?

Yep, that's fine.  (Although you have to be careful not to set values using
more than one of these relationships on the same object :)  But that's not
the same thing as accepting custom sort-by parameters on a per-call basis.

-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=lnkkid=110944bid=241720dat=121642
___
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object


Re: [RDBO] sorted relationship output?

2006-03-14 Thread Michael Lackhoff
On 14 Mar 2006, John Siracusa wrote:

 On 3/14/06 4:17 AM, Michael Lackhoff wrote:
  Is it possible to either define a default sort_by clause in the
  relationship definition
 
 See Uwe's earlier response for how to do this.

Yes, that works great. Thanks!
 
  or when the relationship method is actually used
  ($company-products({sort_by = 'name'}) or something
 
 That's not currently possible because a hashref argument to a relationship
 accessor method already has a meaning:

At the moment I can do without it because I only need one sort order.

 # Set this company's list of products to
 # products 123 and 456
 $company-products({ id = 123 }, { id = 456 });
 
 # Set this company's vendor to Acme
 $company-vendor({ name = 'Acme' });
 
 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?

Yes, perhaps, or a second hashref with meta-args. 
When I was looking for a solution I always thought: It must be 
something like the manager method get_products() and that is read-
only.
But on the other hand perhaps it is better to leave it until you see 
a really good solution.

Cheers,
Michael



---
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=lnkkid=110944bid=241720dat=121642
___
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object


Re: [RDBO] sorted relationship output?

2006-03-14 Thread Michael Lackhoff
On 14 Mar 2006, Uwe Voelker wrote:

 $meta-relationships
 (
  changes = {type = 'one to many',
  class= 'Changes',
  column_map   = {ID = 'AUFTRAG'},
  manager_args = {sort_by = 'CHANGES.DATUM DESC'},
  query_args   = [KATEGORIE = {ne = ''}],
 },
 );
 
 You can use manager_args for the ordering.

Thanks, works like a charm!

Cheers,
Michael




---
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=lnkkid=110944bid=241720dat=121642
___
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object