1 package Catalyst::TraitFor::Model::DBIC::Schema::PerRequestSchema;
3 use namespace::autoclean;
5 requires 'per_request_schema_attributes';
7 with 'Catalyst::Component::InstancePerContext';
9 sub build_per_context_instance {
10 my ( $self, $ctx ) = @_;
11 return $self unless blessed($ctx);
13 my $new = bless {%$self}, ref $self;
15 $new->schema( $new->schema->clone($self->per_request_schema_attributes($ctx)) );
20 __PACKAGE__->meta->make_immutable;