The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Mojolicious::Plugin::DBIC::Controller::DBIC - Build simple views to DBIC data

VERSION

version 0.001

SYNOPSIS

    use Mojolicious::Lite;
    plugin DBIC => { schema => ... };
    get '/', {
        controller => 'DBIC',
        action => 'list',
        resultset => 'BlogPosts',
        template => 'blog/list',
    };

DESCRIPTION

This controller allows for easy working with data from the schema. Controllers are configured through the stash when setting up the routes.

METHODS

list

    get '/', {
        controller => 'DBIC',
        action => 'list',
        resultset => 'BlogPosts',
        template => 'blog/list',
    };

List data in a ResultSet.

This method uses the following stash values for configuration:

resultset

The DBIx::Class::ResultSet class to list.

This method sets the following stash values for template rendering:

resultset

The DBIx::Class::ResultSet object containing the desired objects.

get

    get '/blog/:id', {
        controller => 'DBIC',
        action => 'get',
        resultset => 'BlogPosts',
        template => 'blog/get',
    };

Fetch a single result by its ID.

This method uses the following stash values for configuration:

resultset

The DBIx::Class::ResultSet class to use.

id

The ID to pass to "find" in DBIx::Class::ResultSet.

This method sets the following stash values for template rendering:

row

The DBIx::Class::Row object containing the desired object.

SEE ALSO

AUTHOR

Doug Bell <preaction@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2018 by Doug Bell.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.