DBIx::C...lBuilder(3)

πŸŽ€ NAME πŸŽ€

okay so bestie, this is DBIx::Class::Schema::Loader::RelBuilder β€” it builds relationships for DBIx::Class::Schema::Loader. that's the whole vibe. the manual page title is DBIx::C...lBuilder(3) and it lives under "User Contributed Perl Documentation," for the record πŸ’…


✨ SYNOPSIS ✨

no big synopsis moment here, just a lil pointer:

See DBIx::Class::Schema::Loader and DBIx::Class::Schema::Loader::Base.

go read those, iykyk 🫢


πŸ¦‹ DESCRIPTION πŸ¦‹

so this class builds relationships for DBIx::Class::Schema::Loader. and like β€” real talk β€” this module is not (yet) for external use. meaning: it's an internal bestie, not a public-facing icon. don't @ me when you use it directly, okay? πŸ™ˆ


🌸 METHODS 🌸

πŸ’– new

Arguments: $loader object

that's it, that's the whole vibe check. you hand it the loader, it's born. ⭐

πŸ’œ generate_code

Arguments:

[
    [ local_moniker1 (scalar), fk_info1 (arrayref), uniq_info1 (arrayref) ]
    [ local_moniker2 (scalar), fk_info2 (arrayref), uniq_info2 (arrayref) ]
    ...
]

this generates the code for the relationships of each table. main character energy, honestly πŸ”₯

local_moniker is the moniker name of the table which had the REFERENCES statements. the fk_info arrayref's contents should take the form:

[
    {
        local_table    => 'some_table',
        local_moniker  => 'SomeTable',
        local_columns  => [ 'col2', 'col3' ],
        remote_table   => 'another_table_moniker',
        remote_moniker => 'AnotherTableMoniker',
        remote_columns => [ 'col5', 'col7' ],
    },
    {
        local_table    => 'some_other_table',
        local_moniker  => 'SomeOtherTable',
        local_columns  => [ 'col1', 'col4' ],
        remote_table   => 'yet_another_table_moniker',
        remote_moniker => 'YetAnotherTableMoniker',
        remote_columns => [ 'col1', 'col2' ],
    },
    # ...
],

the uniq_info arrayref's contents should take the form:

[
    [
        uniq_constraint_name         => [ 'col1', 'col2' ],
    ],
    [
        another_uniq_constraint_name => [ 'col1', 'col2' ],
    ],
],

this method will return the generated relationships as a hashref keyed on the class names. the values are arrayrefs of hashes containing method name and arguments, like so:

{
    'Some::Source::Class' => [
        { method => 'belongs_to', arguments => [
          'col1', 'Another::Source::Class' ] },
        { method => 'has_many', arguments => [
          'anothers', 'Yet::Another::Source::Class', 'col15' ] },
    ],
    'Another::Source::Class' => [
        # ...
    ],
    # ...
}

a whole lil relationship map, handed to you in a hashref. slay. πŸ‘‘


🌈 AUTHORS 🌈

See "AUTHORS" in DBIx::Class::Schema::Loader.

the whole squad is credited over there, go give them their flowers 🫢🌸


πŸ“ LICENSE πŸ“

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


okay and the tiny fine print at the bottom of the page? that's perl v5.42.0, dated 2025-07-25, filed under DBIx::C...lBuilder(3) β€” iconic, no cap, periodt πŸ’…βœ¨πŸ§š

πŸ“¦ where this page comes from