DBIx::...elpers(3pm)

πŸ“¦
version 2.037000 Β· 5 versions
, in debian trixie, ubuntu resolute, ubuntu stonking

πŸ’– DBIx::...elpers πŸ’–

okay bestie, welcome to DBIx::Class::Helpers β€” the page that's literally just here to make DBIx::Class less of a whole ordeal. Think of it as the glow-up your schema deserved. We're talking DBIx::...elpers from the User Contributed Perl Documentation corner of the world, and yes, that truncated name is iconic, don't question it. πŸ’…


✨ NAME ✨

DBIx::Class::Helpers β€” Simplify the common case stuff for DBIx::Class. no cap, that's literally the whole mission statement 🫢


πŸ¦‹ SYNOPSIS πŸ¦‹

here's the vibe, copy it, love it:

package MyApp::Schema::Result::Foo_Bar;

__PACKAGE__->load_components(qw{Helper::JoinTable Core});

__PACKAGE__->join_table({
   left_class   => 'Foo',
   left_method  => 'foo',
   right_class   => 'Bar',
   right_method => 'bar',
});

# define parent class
package ParentSchema::Result::Bar;

use strict;
use warnings;

use parent 'DBIx::Class';

__PACKAGE__->load_components('Core');

__PACKAGE__->table('Bar');

__PACKAGE__->add_columns(qw/ id foo_id /);

__PACKAGE__->set_primary_key('id');

__PACKAGE__->belongs_to( foo => 'ParentSchema::Result::Foo', 'foo_id' );

# define subclass
package MySchema::Result::Bar;

use strict;
use warnings;

use parent 'ParentSchema::Result::Bar';

__PACKAGE__->load_components(qw{Helper::SubClass Core});

__PACKAGE__->subclass;

like, look at that. join table? handled. subclassing? handled. you barely lifted a finger. main character energy fr fr ✨


🌈 SEE ALSO 🌈

go read these next, they're the friend group:

  • DBIx::Class::Helper::Row::JoinTable
  • DBIx::Class::Helper::Row::SubClass
  • DBIx::Class::Helpers::Util

πŸŽ€ AUTHOR πŸŽ€

Arthur Axel "fREW" Schmidt <frioux+cpan@gmail.com> β€” actual legend, gave us this whole thing πŸ’œ


This software is copyright (c) 2024 by Arthur Axel "fREW" Schmidt.

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


periodt. that's the whole page, and every last byte of it is here β€” nothing dropped, nothing skipped. 🫢

and that's a wrap, bestie πŸ’– this was DBIx::...elpers as shipped with perl v5.40.0, dated 2024-11-16 β€” go forth and make your schemas slay πŸŒΈπŸ¦‹β­

πŸ“¦ where this page comes from