} else {
my ($first, @rest) = @$data;
- my @names = grep {!ref $first->{$_}} keys %$first;
+ require overload;
+ my @names = grep {
+ (not ref $first->{$_}) || (ref $first->{$_} eq 'SCALAR') ||
+ (overload::Method($first->{$_}, '""'))
+ } keys %$first;
+
my @rels = grep { $self->result_source->has_relationship($_) } keys %$first;
my @pks = $self->result_source->primary_columns;
foreach my $rel (@rels) {
next unless $item->{$rel} && ref $item->{$rel} eq "ARRAY";
- my $parent = $self->find(map {{$_=>$item->{$_}} } @pks)
+ my $parent = $self->find({map { $_ => $item->{$_} } @pks})
|| $self->throw_exception('Cannot find the relating object.');
my $child = $parent->$rel;
: (
( delete $attrs->{columns} )
||
- $source->storage->_order_select_columns(
- $source,
- [ $source->columns ],
- )
+ $source->columns
)
;
attribute, the column names returned are storage-dependent. E.g. MySQL would
return a column named C<count(employeeid)> in the above example.
+B<NOTE:> You will almost always need a corresponding 'as' entry when you use
+'select'.
+
=head2 +select
=over 4