vti / object-db2

ObjectDB2
6 stars 2 forks source link

create_related(has_and_belongs_to_many/has_many) #23

Open yko opened 13 years ago

yko commented 13 years ago

Shouldn't return value depend on passed parameters? If single hashref passed to function, why should it return arrayref/array with single value? Wouldn't it be more organic if it returns single object if there was single hashref in parameters?

vti commented 13 years ago

I think it is the same as for parsing xml. You always want to get an arrayref so you don't have to write something like:

my $objects = $article->create_related(%some_params_from_a_user);
if (ref $objects eq 'ARRAY') {
...
}
else {
...
}