Alias-aware version of Rose::DB::Object::Metadata->column method?

18 views
Skip to first unread message

Mark Frost

unread,
Jun 18, 2010, 2:37:39 PM6/18/10
to Rose::DB::Object
Hey John. I feel like I might have read something about this on the
mailing list, so maybe this was accomplished with a newer version of
Rose than Im using, but I thought Id go ahead and ask anyway:

Im iterating over a hash and wanting to check and see which entries on
it are valid Rose columns for a certain class. I tried using the -
>meta->column($name) method, and then I thought about checking ->meta-
>method_name_is_reserved($name), but neither of these methods seem to
be taking aliases into account. So I have a line like this:

Now, I can run my method name through the ->meta->column_aliases hash
if I have to, or I can check the list from ->meta-
>column_mutator_method_names, but I was hoping there was a simpler one-
liner I could use here that wouldnt require an extra iteration on my
part.

So, is there a method I can use here that is alias-aware to check and
see if $name is the name of a "column" from the Rose-schema (not MySQL
schema) point of view?

John Siracusa

unread,
Jun 18, 2010, 2:51:03 PM6/18/10
to rose-db...@googlegroups.com
On Fri, Jun 18, 2010 at 2:37 PM, Mark Frost <abaddo...@gmail.com> wrote:
> Im iterating over a hash and wanting to check and see which entries on
> it are valid Rose columns for a certain class. I tried using the -
>>meta->column($name) method, and then I thought about checking ->meta-
>>method_name_is_reserved($name), but neither of these methods seem to
> be taking aliases into account. So I have a line like this:
>
> Now, I can run my method name through the ->meta->column_aliases hash
> if I have to, or I can check the list from ->meta-
>>column_mutator_method_names, but I was hoping there was a simpler one-
> liner I could use here that wouldnt require an extra iteration on my
> part.

There is no such method, but the technique you described (check
meta->column() and the column_aliases hash) sounds fine.

-John

Reply all
Reply to author
Forward
0 new messages