Permalink
Browse files

Added back result set code

  • Loading branch information...
1 parent baf5edf commit e14d55f26c0b7bbe97d7affddcf9f73f87e85a43 @kthakore committed Mar 8, 2011
@@ -0,0 +1,29 @@
+package SIMS::Schema::ResultSet::Student;
+
+use strict;
+use warnings;
+
+use Class::Method::Modifiers;
+use namespace::autoclean;
+use base 'DBIx::Class::ResultSet';
+
+use DateTime;
+use SIMS::Schema;
+
+after 'create' => sub {
+ my $self = shift;
+
+ my $h = shift;
+ $self->result_source->schema()->resultset('Event')->create(
+ {
+ ref_id => $h->{user_id},
+ refers_to => 'STUDENT',
+ type => 'DB',
+ timestamp => DateTime->now(),
+ description => "Added new student"
+
+ }
+ );
+};
+
+1;
@@ -0,0 +1,23 @@
+package SIMS::Schema::ResultSet::User;
+
+use strict;
+use warnings;
+
+use Class::Method::Modifiers;
+use namespace::autoclean;
+use base 'DBIx::Class::ResultSet';
+
+sub faculty_users
+{
+ my $self = shift;
+
+ my @userroles = $self->result_source->schema()->resultset('UserRole')->search([{role_id => 1 }, {role_id => 2}, {role_id => 5}]);
+
+ my @users;
+
+ push (@users, $_->user) foreach( @userroles );
+
+ return \@users;
+}
+
+1;

0 comments on commit e14d55f

Please sign in to comment.