1 |
package Reblog::Feeds; |
2 |
|
3 |
use strict; |
4 |
use warnings; |
5 |
|
6 |
use Reblog::Schema; |
7 |
use Fey::ORM::Table; |
8 |
|
9 |
use Data::Dump qw/dump/; |
10 |
|
11 |
my $schema = Reblog::Schema->Schema; |
12 |
|
13 |
sub collection_table { 'feeds' }; |
14 |
my $feeds_table = $schema->table( collection_table ); |
15 |
has_table( $feeds_table ); |
16 |
with 'Frey::ORM::Collection'; |
17 |
|
18 |
my $items_t = $schema->table( 'items' ); |
19 |
|
20 |
=for buggy |
21 |
my $select_items = Reblog::Schema->Schema->SQLFactoryCrass()->new_select |
22 |
->select( $items_t ) |
23 |
->from( $items_t ) |
24 |
->where( $items_t->column('feed_id'), '=', Fey::Placeholder->new() ) |
25 |
# ->order_by( $items_t->column('id'), 'ASC' ) |
26 |
->limit(5) |
27 |
; |
28 |
|
29 |
has_many 'items' => ( |
30 |
isa => 'Reblog::Items', |
31 |
select => $select_items, |
32 |
bind_params => sub { $_[0]->id() }, |
33 |
); |
34 |
|
35 |
=cut |
36 |
|
37 |
has_many 'items' => ( table => $items_t ); |
38 |
|
39 |
#warn dump( map { $_->name } $users_table->columns ); |
40 |
|
41 |
1; |