1 package DBIx::Class::ResultSetManager;
4 use base 'DBIx::Class';
7 use DBIx::Class::_Util 'set_subname';
10 warn "DBIx::Class::ResultSetManager never left experimental status and
11 has now been DEPRECATED. This module will be deleted in 09000 so please
12 migrate any and all code using it to explicit resultset classes using either
13 __PACKAGE__->resultset_class(...) calls or by switching from using
14 DBIx::Class::Schema->load_classes() to load_namespaces() and creating
15 appropriate My::Schema::ResultSet::* classes for it to pick up.";
19 DBIx::Class::ResultSetManager - scheduled for deletion in 09000
23 DBIx::Class::ResultSetManager never left experimental status and
24 has now been DEPRECATED. This module will be deleted in 09000 so please
25 migrate any and all code using it to explicit resultset classes using either
26 __PACKAGE__->resultset_class(...) calls or by switching from using
27 DBIx::Class::Schema->load_classes() to load_namespaces() and creating
28 appropriate My::Schema::ResultSet::* classes for it to pick up.";
32 __PACKAGE__->mk_classdata($_)
33 for qw/ base_resultset_class table_resultset_class_suffix /;
34 __PACKAGE__->base_resultset_class('DBIx::Class::ResultSet');
35 __PACKAGE__->table_resultset_class_suffix('::_resultset');
38 my ($self,@rest) = @_;
39 my $ret = $self->next::method(@rest);
41 $self->_register_attributes;
42 $self->_register_resultset_class;
47 sub load_resultset_components {
48 my ($self,@comp) = @_;
49 my $resultset_class = $self->_setup_resultset_class;
50 $resultset_class->load_components(@comp);
53 sub _register_attributes {
55 my $cache = $self->_attr_cache;
56 return if keys %$cache == 0;
58 foreach my $meth (keys %{ { map
61 { Package::Stash->new($_)->list_all_symbols("CODE") }
62 @{ mro::get_linear_isa( ref $self || $self ) }
64 # *DO NOT* rely on P::S returning crefs in reverse mro order
65 # but instead ask the mro to redo the lookup
66 # This codepath is extremely old, miht as well keep it running
67 # as-is with no room for surprises
68 my $attrs = $cache->{$self->can($meth)};
70 if ($attrs->[0] eq 'ResultSet') {
72 my $resultset_class = $self->_setup_resultset_class;
73 my $name = join '::',$resultset_class, $meth;
74 *$name = set_subname $name, $self->can($meth);
75 delete ${"${self}::"}{$meth};
80 sub _setup_resultset_class {
82 my $resultset_class = $self . $self->table_resultset_class_suffix;
84 unless (@{"$resultset_class\::ISA"}) {
85 @{"$resultset_class\::ISA"} = ($self->base_resultset_class);
87 return $resultset_class;
90 sub _register_resultset_class {
92 my $resultset_class = $self . $self->table_resultset_class_suffix;
94 if (@{"$resultset_class\::ISA"}) {
95 $self->result_source_instance->resultset_class($resultset_class);
97 $self->result_source_instance->resultset_class
98 ($self->base_resultset_class);
102 =head1 FURTHER QUESTIONS?
104 Check the list of L<additional DBIC resources|DBIx::Class/GETTING HELP/SUPPORT>.
106 =head1 COPYRIGHT AND LICENSE
108 This module is free software L<copyright|DBIx::Class/COPYRIGHT AND LICENSE>
109 by the L<DBIx::Class (DBIC) authors|DBIx::Class/AUTHORS>. You can
110 redistribute it and/or modify it under the same terms as the
111 L<DBIx::Class library|DBIx::Class/COPYRIGHT AND LICENSE>.