1 package SL::DB::EmailJournal;
 
   5 use SL::DB::MetaSetup::EmailJournal;
 
   6 use SL::DB::Manager::EmailJournal;
 
   7 use SL::DB::Helper::AttrSorted;
 
   9 __PACKAGE__->meta->add_relationship(
 
  11     type       => 'one to many',
 
  12     class      => 'SL::DB::EmailJournalAttachment',
 
  13     column_map => { id => 'email_journal_id' },
 
  17 __PACKAGE__->meta->initialize;
 
  19 __PACKAGE__->attr_sorted('attachments');
 
  22   my ($self, $other) = @_;
 
  24   return -1 if  $self->sent_on && !$other->sent_on;
 
  25   return  1 if !$self->sent_on &&  $other->sent_on;
 
  28   $result    = $other->sent_on <=> $self->sent_on;
 
  29   return $result || ($self->id <=> $other->id);
 
  42 SL::DB::EmailJournal - RDBO model for email journal
 
  46 This is a standard Rose::DB::Object based model and can be used as one.
 
  52 =item C<compare_to $self, $other>
 
  54 Compares C<$self> with C<$other> and returns the newer entry.