package Mojo::Util::Model;
use Mojo::Base -base;
our $VERSION = '0.0.17';
use Mojo::JSON qw(encode_json);
has 'exists' => sub {
return shift->pk ? 1 : 0;
};
has 'id';
has 'keys_to_serialize'
r));
}
return join(',', @array);
}
=head2 toJson
Returns a JSON representation of the model.
=cut
sub toJson {
return encode_json(shift->serialize);
}
=head2 AUTOLOAD
Try to get a f
o::Util::Collection::Formatter;
use Mojo::Base -base;
our $VERSION = '0.0.17';
use Mojo::JSON qw(encode_json);
=head2 asOptions
Return an array ref containing [{ value => $value, label => $label }
$header) if ($header);
return join("\n", @array);
}
=head2 toJson
Convert collection to JSON string
=cut
sub toJson {
my $self = shift;
return encode_json($self->toArray(@_));
}
1;
toCsv($self->objects, @_);
}
=head2 toJson
Convert collection to JSON string
=cut
sub toJson {
my $self = shift;
return $self->formatter->toJson($self->objects, @_);
}
=head2 touch