| 1 | 2 | ▶ | use utf8; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 2 | |||
| 3 | package Interchange6::Schema; | ||
| 4 | |||
| 5 | =encoding utf8 | ||
| 6 | |||
| 7 | =head1 NAME | ||
| 8 | |||
| 9 | Interchange6::Schema - Database Schema for Interchange 6 | ||
| 10 | |||
| 11 | =head1 VERSION | ||
| 12 | |||
| 13 | 0.133 | ||
| 14 | |||
| 15 | =cut | ||
| 16 | |||
| 17 | 2 | our $VERSION = '0.133'; | |
| 18 | |||
| 19 | =head1 MANUAL | ||
| 20 | |||
| 21 | Please see the L<Interchange6 Schema Manual|Interchange6::Schema::Manual> | ||
| 22 | for an overview of available documentation. | ||
| 23 | |||
| 24 | =head1 DESCRIPTION | ||
| 25 | |||
| 26 | Database schema classes for Interchange6 Open Source eCommerce software. | ||
| 27 | |||
| 28 | The minimum Perl version for Interchange6::Schema is 5.8. | ||
| 29 | |||
| 30 | =head1 BASE CLASS | ||
| 31 | |||
| 32 | L<DBIx::Class::Schema::Config> | ||
| 33 | |||
| 34 | If you inherit from L<Interchange6::Schema> then in order to make use of | ||
| 35 | L<DBIx::Class::Schema::Config> in your own schema you must load it as a | ||
| 36 | component. | ||
| 37 | |||
| 38 | =head1 COMPONENTS | ||
| 39 | |||
| 40 | Components used: | ||
| 41 | |||
| 42 | =over | ||
| 43 | |||
| 44 | =item * L<DBIx::Class::Helper::Schema::DateTime> | ||
| 45 | |||
| 46 | =item * L<DBIx::Class::Helper::Schema::QuoteNames> | ||
| 47 | |||
| 48 | =back | ||
| 49 | |||
| 50 | =cut | ||
| 51 | |||
| 52 | 2 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 53 | 2 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 54 | |||
| 55 | 2 | ▶ | use base 'DBIx::Class::Schema::Config'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 56 | |||
| 57 | 2 | __PACKAGE__->load_components( 'Helper::Schema::DateTime', | |
| 58 | 'Helper::Schema::QuoteNames' ); | ||
| 59 | |||
| 60 | 2 | __PACKAGE__->load_namespaces( | |
| 61 | default_resultset_class => 'ResultSet', | ||
| 62 | ); | ||
| 63 | |||
| 64 | =head1 ATTRIBUTES | ||
| 65 | |||
| 66 | =head2 current_user | ||
| 67 | |||
| 68 | This attribute can be used to stash the L<Interchange6::Schema::Result::User> | ||
| 69 | object of the currently logged in user. If set then any result class and | ||
| 70 | resultset methods which take C<users_id> as an argument will make use of | ||
| 71 | the value of this attribute to set C<users_id>. | ||
| 72 | |||
| 73 | =over | ||
| 74 | |||
| 75 | =item writer: set_current_user | ||
| 76 | |||
| 77 | =back | ||
| 78 | |||
| 79 | =cut | ||
| 80 | |||
| 81 | =head2 user_locale | ||
| 82 | |||
| 83 | This attribute can be used to store the locale of the current user. | ||
| 84 | |||
| 85 | =over | ||
| 86 | |||
| 87 | =item writer: set_user_locale | ||
| 88 | |||
| 89 | =back | ||
| 90 | |||
| 91 | =cut | ||
| 92 | |||
| 93 | 2 | __PACKAGE__->mk_group_ro_accessors( | |
| 94 | inherited => ( | ||
| 95 | [ 'current_user' => '_ic6_current_user' ], | ||
| 96 | [ 'user_locale' => '_ic6_user_locale' ], | ||
| 97 | ) | ||
| 98 | ); | ||
| 99 | |||
| 100 | 2 | __PACKAGE__->mk_group_wo_accessors( | |
| 101 | inherited => ( | ||
| 102 | [ 'set_current_user' => '_ic6_current_user' ], | ||
| 103 | [ 'set_user_locale' => '_ic6_user_locale' ], | ||
| 104 | ) | ||
| 105 | ); | ||
| 106 | |||
| 107 | =head1 METHODS | ||
| 108 | |||
| 109 | =head2 deploy | ||
| 110 | |||
| 111 | Overload L<DBIx::Class::Schema/deploy> in order to add some core fixtures | ||
| 112 | via L<Interchange6::Schema::Populate>. | ||
| 113 | |||
| 114 | =cut | ||
| 115 | |||
| 116 | { | ||
| 117 | 2 | ▶ | use Interchange6::Schema::Populate; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 118 | |||
| 119 | 1 | ▶ | sub deploy { |
|
Subroutine
deploy: called CC=1 SCAR=0.0
Pod
documented
| |||
| 120 | 1 | my $self = shift; | |
| 121 | 1 | my $new = $self->next::method(@_); | |
| 122 | |||
| 123 | 1 | Interchange6::Schema::Populate->new( schema => $self )->populate; | |
| 124 | |||
| 125 | # $self->resultset('Website')->create( | ||
| 126 | # { | ||
| 127 | # fqdn => "*", | ||
| 128 | # name => "Default", | ||
| 129 | # description => "Default Website" | ||
| 130 | # } | ||
| 131 | # ); | ||
| 132 | } | ||
| 133 | } | ||
| 134 | |||
| 135 | 2 | 1; | |
| 136 | |||
| 137 | __END__ | ||