Re: getting all method names
[prev]
[thread]
[next]
[Date index for 2005/04/05]
On 5 Apr 2005, at 05:03, mlambrichs@xxxxxxxxxx.xx wrote:
> How can I get a list of all possible attributes/methods of a cdbi
> class?
$class->columns('All')
will give you the list of attribute names, some of which will be
columns that inflate to a has_a relationship, but all of which can be
accessed in the same way, so this will work:
my $object = Model::Object->retrieve( $id );
for ($object->columns('All')){
do_something( $object->get($_) );
}
If your DTO needs to carry related objects too, you can call
$class->meta_info('has_many');
to get a hashref describing all the has_many relationships of a class
or object in a form like
{
{
accessor => method_name,
foreign_class => Class::Name,
...
},
...
}
and $class->meta_info('has_a') will do the same for has_a relationships
if you need to separate those out and treat them differently to plain
columns.
best
will
|
|
Re: getting all method names
William Ross 08:26 on 05 Apr 2005
|