DBIx-Class-TemporalRelations

 view release on metacpan or  search on metacpan

README.mkdn  view on Meta::CPAN

    $thing = $user->last_thing_created;
    $thing = $user->first_thing_created_after($ts);
    $thing = $user->last_thing_created_before($ts);

And if you could also **modify** things, and stashed the last time the thing was modified, and by whom, in the
`thing` table:

    @thing = $user->things_modified;
    $thing = $user->last_thing_modified;

(...but see ["BUGS AND LIMITATIONS"](#bugs-and-limitations) for an important limitation on this behavior!)

# CONFIGURATION

In your Result class, once you've loaded this component, you have three ways to 
add temporal relationships:

## Direct injection into `source_info`

    __PACKAGE__->source_info(
       {

README.mkdn  view on Meta::CPAN

       ...
    );

# DEPENDENCIES

- [DBIx::Class](https://metacpan.org/pod/DBIx%3A%3AClass)
- Optionally, [DBIx::Class::Candy](https://metacpan.org/pod/DBIx%3A%3AClass%3A%3ACandy)
- [Lingua::EN::Inflexion](https://metacpan.org/pod/Lingua%3A%3AEN%3A%3AInflexion)
- [Sub::Quote](https://metacpan.org/pod/Sub%3A%3AQuote)

# BUGS AND LIMITATIONS

- Overwriteable fields

    If you set a temporal relationship on a field that can be overwritten, for example `modified_by`, realize
    that the temporal relationship will disappear. This isn't a full activity log! For that, you probably want
    something like [DBIx::Class::AuditAny](https://metacpan.org/pod/DBIx%3A%3AClass%3A%3AAuditAny) or other similar journaling module.

# ACKNOWLEDGEMENTS

Thanks goes out to my employer, Clearbuilt, for letting me spend some work time on this module.

lib/DBIx/Class/TemporalRelations.pm  view on Meta::CPAN

   $thing = $user->last_thing_created;
   $thing = $user->first_thing_created_after($ts);
   $thing = $user->last_thing_created_before($ts);

And if you could also B<modify> things, and stashed the last time the thing was modified, and by whom, in the
C<thing> table:

   @thing = $user->things_modified;
   $thing = $user->last_thing_modified;

(...but see L</BUGS AND LIMITATIONS> for an important limitation on this behavior!)

=head1 CONFIGURATION

In your Result class, once you've loaded this component, you have three ways to 
add temporal relationships:

=head2 Direct injection into C<source_info>

   __PACKAGE__->source_info(
      {

lib/DBIx/Class/TemporalRelations.pm  view on Meta::CPAN

=item L<DBIx::Class>

=item Optionally, L<DBIx::Class::Candy>

=item L<Lingua::EN::Inflexion>

=item L<Sub::Quote>

=back

=head1 BUGS AND LIMITATIONS

=over 4

=item Overwriteable fields

If you set a temporal relationship on a field that can be overwritten, for example C<modified_by>, realize
that the temporal relationship will disappear. This isn't a full activity log! For that, you probably want
something like L<DBIx::Class::AuditAny> or other similar journaling module.

=back



( run in 0.360 second using v1.01-cache-2.11-cpan-fd5d4e115d8 )