1 package Catalyst::TraitFor::Model::DBIC::Schema::PerRequestSchema;
3 use namespace::autoclean;
8 confess("You have not implemented a per_request_schema_attributes method in " . ref($self))
9 unless $self->can('per_request_schema_attributes');
12 with 'Catalyst::Component::InstancePerContext';
14 sub build_per_context_instance {
15 my ( $self, $ctx ) = @_;
16 return $self unless blessed($ctx);
18 my $new = bless {%$self}, ref $self;
20 $new->schema( $new->schema->clone($self->per_request_schema_attributes($ctx)) );
25 __PACKAGE__->meta->make_immutable;