[Catalyst] Re: Help needed on
	DBIx::Class::Schema::RestrictWithObject
    Mario Minati 
    mario.minati at googlemail.com
       
    Tue Dec  4 23:28:16 GMT 2007
    
    
  
I am still trying to get this stuff working, still not sucessfully.
I created a new modell class according to 
http://www.shadowcat.co.uk/catalyst/-talks/oscon/crucible.xul 
But I always get compilation errors:
Couldn't instantiate 
component "glue::Model::DBIC::RestrictedSchema", "->config->{schema_class} 
must be defined for this model at ./script/glue_server.pl line 53" 
at ./script/glue_server.pl line 53
That is what my new Schema looks like:
package glue::Model::DBIC::RestrictedSchema;
use Moose;
extends 'Catalyst::Model::DBIC::Schema';
with 'Catalyst::Component::InstancePerContext';
sub build_per_context_instance {
    my ($self, $c) = @_;
    my $user = $c->session;
    my $schema = $self->schema->restrict_with_object( $user );
    return $self->new({ schema => $schema });
}
When I remove the extends line then the compilation works, but for sure the 
model is useless.
I would realy appricate any help on how to get this working.
Greets,
Mario
On Monday 03 December 2007 22:48:32 you wrote:
> Hi,
>
> I'm trying to realize a resultset filtering with
> DBIx::Class::Schema::RestrictWithObject but have troubles in understanding
> how to set things up correctly.
>
> What I would like to achieve:
> Filter resultsets based on data in the Catalyst Session storage.
>
> Currently I have:
>
> package glueDB;
> use base qw/DBIx::Class::Schema/;
> __PACKAGE__->load_components(qw/Schema::RestrictWithObject/);
> __PACKAGE__->load_classes( {
>         glueDB => [
>             qw/
>                 Contact::Company
> 		...
>                 /
>         ] } );
>
> package glue::Model::glueDB;
> use base 'Catalyst::Model::DBIC::Schema';
> __PACKAGE__->config(
>     schema_class => 'glueDB',
>     connect_info => [ ... ],
> );
>
>
> My question:
>
> 1.
> Where do I have to create the restricting object.
> Do I have to rewrite Catalyst::Model::DBIx::Class?
>
>
> Thanks for your help.
>
>
> Greets,
>
> Mario Minati
    
    
More information about the Catalyst
mailing list