On 6/4/07, Jonathan Vanasco <[EMAIL PROTECTED]> wrote:
> is there a convenient way to get a setter for a relationship?
Yes, and it works the same way as for columns. Like columns,
relationships and foreign keys have N named method types created on
their behalf. Examples of method type names are get, get_set,
get_set_on_save, find, count, etc. There are default method type
lists, but users can alter the list by adding and removing types on a
per-relationship basis.
You can ask any metadata object that makes methods for the name of the
method of a given type by calling the method_name() method. For
example, the column->accessor_method_name implementation is really
just:
return $column->method_name('get') || $column->method_name('get_set')
http://search.cpan.org/dist/Rose-DB-Object/lib/Rose/DB/Object/Metadata/Column.pm#accessor_method_name
http://search.cpan.org/dist/Rose-DB-Object/lib/Rose/DB/Object/Metadata/Column.pm#method_name
So, to get a "getter" for a relationship, call:
$rel->method_name('...') || $rel->method_name('...') || ...
where the "..." parts are the method type names in your order of preference.
http://search.cpan.org/dist/Rose-DB-Object/lib/Rose/DB/Object/Metadata/Relationship.pm#method_name
See the relationship docs for the list of supported method types.
-John
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Rose-db-object mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rose-db-object