NAME
DBIx::Class::Smooth::Schema - Short intro
VERSION
Version 0.0108, released 2020-11-29.
SYNOPSIS
# in MyApp::Schema, instead of inheriting from DBIx::Class::Schema
use parent 'DBIx::Class::Smooth::Schema';
DESCRIPTION
DBIx::Class::Smooth::Schema adds method accessors for all resultsets.
In short, instead of this:
my $schema = MyApp::Schema->connect(...);
my $result = $schema->resultset('Author');
You can do this:
my $schema = MyApp::Schema->connect(...);
my $result = $schema->Author;
What is returned?
The resultset methods can be called in four different ways.
Without arguments
# $schema->resultset('Author')
$schema->Author;
With a scalar
# $schema->resultset('Author')->find(5)
$schema->Author(5);
With an array reference
# $schema->resultset('Book')->find({ author => 'J.R.R Tolkien', title => 'The Hobbit' }, { key => 'book_author_title' });
$schema->Book([book_author_title => { author => 'J.R.R Tolkien', title => 'The Hobbit' }]);
With anything else
# $schema->resultset('Author')->search({ last_name => 'Tolkien'}, { order_by => { -asc => 'first_name' }});
$schema->Author({ last_name => 'Tolkien'}, { order_by => { -asc => 'first_name' }});
SEE ALSO
SOURCE
https://github.com/Csson/p5-DBIx-Class-Smooth
HOMEPAGE
https://metacpan.org/release/DBIx-Class-Smooth
AUTHOR
Erik Carlsson <info@code301.com>
COPYRIGHT AND LICENSE
This software is copyright (c) 2018 by Erik Carlsson.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.